home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / GNU / gnuplot.lha / gnuplot / src / term.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-28  |  68.8 KB  |  2,276 lines

  1. #ifndef lint
  2. static char *RCSid = "$Id: term.c%v 3.50.1.17 1993/08/27 05:21:33 woo Exp woo $";
  3. #endif
  4.  
  5.  
  6. /* GNUPLOT - term.c */
  7. /*
  8.  * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software is provided "as is" without express or implied warranty.
  21.  * 
  22.  *
  23.  * AUTHORS
  24.  * 
  25.  *   Original Software:
  26.  *     Thomas Williams,  Colin Kelley.
  27.  * 
  28.  *   Gnuplot 2.0 additions:
  29.  *       Russell Lang, Dave Kotz, John Campbell.
  30.  *
  31.  *   Gnuplot 3.0 additions:
  32.  *       Gershon Elber and many others.
  33.  * 
  34.  * There is a mailing list for gnuplot users. Note, however, that the
  35.  * newsgroup 
  36.  *    comp.graphics.gnuplot 
  37.  * is identical to the mailing list (they
  38.  * both carry the same set of messages). We prefer that you read the
  39.  * messages through that newsgroup, to subscribing to the mailing list.
  40.  * (If you can read that newsgroup, and are already on the mailing list,
  41.  * please send a message info-gnuplot-request@dartmouth.edu, asking to be
  42.  * removed from the mailing list.)
  43.  *
  44.  * The address for mailing to list members is
  45.  *       info-gnuplot@dartmouth.edu
  46.  * and for mailing administrative requests is 
  47.  *       info-gnuplot-request@dartmouth.edu
  48.  * The mailing list for bug reports is 
  49.  *       bug-gnuplot@dartmouth.edu
  50.  * The list of those interested in beta-test versions is
  51.  *       info-gnuplot-beta@dartmouth.edu
  52.  */
  53.  
  54. #include <stdio.h>
  55. #include <ctype.h>
  56. #include "plot.h"
  57. #include "setshow.h"
  58. #include "term.h"
  59. #include "bitmap.h"
  60. #ifdef NEXT
  61. #include <stdlib.h>
  62. #include "epsviewe.h"
  63. #endif /* NEXT */
  64.  
  65. #ifdef _Windows
  66. #ifdef __MSC__
  67. #include <malloc.h>
  68. #else
  69. #include <alloc.h>
  70. #endif
  71. #else
  72. #include <stdlib.h>        /* use ANSI comp. (m)alloc and free */
  73. #endif
  74.  
  75. #if defined(__TURBOC__) && defined(MSDOS)
  76. #ifndef _Windows
  77. #include <dos.h>
  78. #endif
  79. #endif
  80.  
  81. /* for use by all drivers */
  82. #define sign(x) ((x) >= 0 ? 1 : -1)
  83. #define abs(x) ((x) >= 0 ? (x) : -(x))
  84.  
  85. #ifndef max    /* GCC uses inline functions */
  86. #define max(a,b) ((a) > (b) ? (a) : (b))
  87. #endif
  88. #ifndef min
  89. #define min(a,b) ((a) < (b) ? (a) : (b))
  90. #endif
  91.  
  92. TBOOLEAN term_init;            /* true if terminal has been initialized */
  93.  
  94. extern FILE *outfile;
  95. extern char outstr[];
  96. extern TBOOLEAN term_init;
  97. extern int term;
  98. extern float xsize, ysize;
  99.  
  100. extern char input_line[];
  101. extern struct lexical_unit token[];
  102. extern int num_tokens, c_token;
  103. extern struct value *const_express();
  104.  
  105. extern TBOOLEAN interactive;
  106.  
  107. /*
  108.  * instead of <strings.h>
  109.  */
  110.  
  111. #if defined(_Windows) || ( defined(__TURBOC__) && defined(MSDOS) )
  112. # include <string.h>
  113. #else
  114. #ifdef ATARI
  115. #include <string.h>
  116. #include <math.h>
  117. #else
  118. #ifndef AMIGA_SC_6_1
  119. extern char *strcpy();
  120. #ifdef ANSI
  121. extern size_t   strlen();
  122. #else
  123. extern int      strlen();
  124. #endif
  125. extern int  strcmp(), strncmp();
  126. #endif /* !AMIGA_SC_6_1 */
  127. #endif
  128. #endif
  129.  
  130. #ifndef AMIGA_AC_5
  131. extern double sqrt();
  132. #endif
  133.  
  134. char *getenv();
  135.  
  136. #if defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)
  137. char *turboc_init();
  138. #endif
  139.  
  140. #ifdef __ZTC__
  141. char *ztc_init();
  142. /* #undef TGIF */
  143. #endif
  144.  
  145.  
  146. #if defined(MSDOS)||defined(ATARI)||defined(OS2)||defined(_Windows)||defined(DOS386)
  147. void reopen_binary();
  148. #define REOPEN_BINARY
  149. #endif
  150. #ifdef vms
  151. char *vms_init();
  152. void vms_reset();
  153. void term_mode_tek();
  154. void term_mode_native();
  155. void term_pasthru();
  156. void term_nopasthru();
  157. void reopen_binary();
  158. void fflush_binary();
  159. #define REOPEN_BINARY
  160. #endif
  161.  
  162. /* This is needed because the unixplot library only writes to stdout. */
  163. #ifdef UNIXPLOT
  164. FILE save_stdout;
  165. #endif
  166. int unixplot=0;
  167.  
  168. #define NICE_LINE        0
  169. #define POINT_TYPES        6
  170.  
  171.  
  172. do_point(x,y,number)
  173. int x,y;
  174. int number;
  175. {
  176. register int htic,vtic;
  177. register struct termentry *t = &term_tbl[term];
  178.  
  179.      if (number < 0) {        /* do dot */
  180.         (*t->move)(x,y);
  181.         (*t->vector)(x,y);
  182.         return(0);
  183.     }
  184.  
  185.     number %= POINT_TYPES;
  186.     htic = (t->h_tic/2);    /* should be in term_tbl[] in later version */
  187.     vtic = (t->v_tic/2);    
  188.  
  189.     switch(number) {
  190.         case 0: /* do diamond */ 
  191.                 (*t->move)(x-htic,y);
  192.                 (*t->vector)(x,y-vtic);
  193.                 (*t->vector)(x+htic,y);
  194.                 (*t->vector)(x,y+vtic);
  195.                 (*t->vector)(x-htic,y);
  196.                 (*t->move)(x,y);
  197.                 (*t->vector)(x,y);
  198.                 break;
  199.         case 1: /* do plus */ 
  200.                 (*t->move)(x-htic,y);
  201.                 (*t->vector)(x-htic,y);
  202.                 (*t->vector)(x+htic,y);
  203.                 (*t->move)(x,y-vtic);
  204.                 (*t->vector)(x,y-vtic);
  205.                 (*t->vector)(x,y+vtic);
  206.                 break;
  207.         case 2: /* do box */ 
  208.                 (*t->move)(x-htic,y-vtic);
  209.                 (*t->vector)(x-htic,y-vtic);
  210.                 (*t->vector)(x+htic,y-vtic);
  211.                 (*t->vector)(x+htic,y+vtic);
  212.                 (*t->vector)(x-htic,y+vtic);
  213.                 (*t->vector)(x-htic,y-vtic);
  214.                 (*t->move)(x,y);
  215.                 (*t->vector)(x,y);
  216.                 break;
  217.         case 3: /* do X */ 
  218.                 (*t->move)(x-htic,y-vtic);
  219.                 (*t->vector)(x-htic,y-vtic);
  220.                 (*t->vector)(x+htic,y+vtic);
  221.                 (*t->move)(x-htic,y+vtic);
  222.                 (*t->vector)(x-htic,y+vtic);
  223.                 (*t->vector)(x+htic,y-vtic);
  224.                 break;
  225.         case 4: /* do triangle */ 
  226.                 (*t->move)(x,y+(4*vtic/3));
  227.                 (*t->vector)(x-(4*htic/3),y-(2*vtic/3));
  228.                 (*t->vector)(x+(4*htic/3),y-(2*vtic/3));
  229.                 (*t->vector)(x,y+(4*vtic/3));
  230.                 (*t->move)(x,y);
  231.                 (*t->vector)(x,y);
  232.                 break;
  233.         case 5: /* do star */ 
  234.                 (*t->move)(x-htic,y);
  235.                 (*t->vector)(x-htic,y);
  236.                 (*t->vector)(x+htic,y);
  237.                 (*t->move)(x,y-vtic);
  238.                 (*t->vector)(x,y-vtic);
  239.                 (*t->vector)(x,y+vtic);
  240.                 (*t->move)(x-htic,y-vtic);
  241.                 (*t->vector)(x-htic,y-vtic);
  242.                 (*t->vector)(x+htic,y+vtic);
  243.                 (*t->move)(x-htic,y+vtic);
  244.                 (*t->vector)(x-htic,y+vtic);
  245.                 (*t->vector)(x+htic,y-vtic);
  246.                 break;
  247.     }
  248. }
  249.  
  250.  
  251. /*
  252.  * general point routine
  253.  */
  254. line_and_point(x,y,number)
  255. int x,y,number;
  256. {
  257.     /* temporary(?) kludge to allow terminals with bad linetypes 
  258.         to make nice marks */
  259.  
  260.     (*term_tbl[term].linetype)(NICE_LINE);
  261.     do_point(x,y,number);
  262. }
  263.  
  264. /* 
  265.  * general arrow routine
  266.  */
  267. #define ROOT2 (1.41421)        /* sqrt of 2 */
  268.  
  269. do_arrow(sx, sy, ex, ey, head)
  270.     int sx,sy;            /* start point */
  271.     int ex, ey;            /* end point (point of arrowhead) */
  272.     TBOOLEAN head;
  273. {
  274.     register struct termentry *t = &term_tbl[term];
  275.     int len = (t->h_tic + t->v_tic)/2; /* arrowhead size = avg of tic sizes */
  276.  
  277.     /* draw the line for the arrow. That's easy. */
  278.     (*t->move)(sx, sy);
  279.     (*t->vector)(ex, ey);
  280.  
  281.     if (head) {
  282.     /* now draw the arrow head. */
  283.     /* we put the arrowhead marks at 45 degrees to line */
  284.        if (sx == ex) {
  285.        /* vertical line, special case */
  286.           int delta = ((float)len / ROOT2 + 0.5);
  287.           if (sy < ey)
  288.               delta = -delta;    /* up arrow goes the other way */
  289.           (*t->move)(ex - delta, ey + delta);
  290.           (*t->vector)(ex,ey);
  291.           (*t->vector)(ex + delta, ey + delta);
  292.        } else {
  293.           int dx = sx - ex;
  294.           int dy = sy - ey;
  295.           double coeff = len / sqrt(2.0*((double)dx*(double)dx 
  296.                    + (double)dy*(double)dy));
  297.           int x,y;            /* one endpoint */
  298.  
  299.           x = (int)( ex + (dx + dy) * coeff );
  300.           y = (int)( ey + (dy - dx) * coeff );
  301.           (*t->move)(x,y);
  302.           (*t->vector)(ex,ey);
  303.  
  304.           x = (int)( ex + (dx - dy) * coeff );
  305.           y = (int)( ey + (dy + dx) * coeff );
  306.           (*t->vector)(x,y);
  307.        }
  308.     }
  309. }
  310.  
  311. #ifdef DUMB                    /* paper or glass dumb terminal */
  312. #include "term/dumb.trm"
  313. #endif
  314.  
  315.  
  316. #ifndef _Windows
  317. # ifdef PC            /* all PC types except MS WINDOWS*/
  318. #  include "term/pc.trm"
  319. # endif
  320. #else
  321. #  include "term/win.trm"
  322. #endif
  323.  
  324. #ifdef __ZTC__
  325. #include "term/fg.trm"
  326. #endif
  327.  
  328. #ifdef DJSVGA
  329. #include "term/djsvga.trm"    /* DJGPP SVGA */
  330. #endif
  331.  
  332. #ifdef EMXVGA
  333. #include "term/emxvga.trm"    /* EMX VGA */
  334. #endif
  335.  
  336. #ifdef OS2PM                    /* os/2 presentation manager */
  337. #include "term/pm.trm"
  338. #endif
  339.  
  340. #ifdef ATARI            /* ATARI-ST */
  341. #include "term/atari.trm"
  342. #endif
  343.  
  344. /*
  345.    all TEK types (TEK,BITGRAPH,KERMIT,VTTEK,SELANAR) are ifdef'd in tek.trm,
  346.    but most require various TEK routines.  Hence TEK must be defined for
  347.    the others to compile.
  348. */
  349. #ifdef BITGRAPH
  350. # ifndef TEK
  351. #  define TEK
  352. # endif
  353. #endif
  354.  
  355. #ifdef SELENAR
  356. # ifndef TEK
  357. #  define TEK
  358. # endif
  359. #endif
  360.  
  361. #ifdef KERMIT
  362. # ifndef TEK
  363. #  define TEK
  364. # endif
  365. #endif
  366.  
  367. #ifdef LN03P
  368. # ifndef TEK
  369. #  define TEK
  370. # endif
  371. #endif
  372.  
  373. #ifdef VTTEK
  374. # ifndef TEK
  375. #  define TEK
  376. # endif
  377. #endif
  378.  
  379. #ifdef T410X        /* Tektronix 4106, 4107, 4109 and 420x terminals */
  380. #include "term/t410x.trm"
  381. #endif
  382.  
  383. #ifdef TEK            /* all TEK types, TEK, BBN, SELANAR, KERMIT, VTTEK */
  384. #include "term/tek.trm"
  385. #endif
  386.  
  387. #ifdef OKIDATA
  388. #define EPSONP
  389. #endif
  390.  
  391. #ifdef EPSONP    /* bit map types, EPSON, NEC, PROPRINTER, STAR Color */
  392. #include "term/epson.trm"
  393. #endif
  394.  
  395. #ifdef HP500C  /* HP 500 deskjet Colour */
  396. #include "term/hp500c.trm"
  397. #endif
  398.  
  399. #ifdef HPLJII        /* HP LaserJet II */
  400. #include "term/hpljii.trm"
  401. #endif
  402.  
  403. #ifdef PCL /* HP LaserJet III in HPGL mode */
  404. #  ifndef HPGL
  405. #    define HPGL
  406. #  endif
  407. #endif
  408.  
  409. #ifdef HPPJ        /* HP PaintJet */
  410. #include "term/hppj.trm"
  411. #endif
  412.  
  413. #ifdef FIG            /* Fig 2.1 Interactive graphics program */
  414. #include "term/fig.trm"
  415. #include "term/bigfig.trm"
  416. #endif
  417.   
  418. #ifdef GPR              /* Apollo Graphics Primitive Resource (fixed-size window) */
  419. #include "term/gpr.trm"
  420. #endif /* GPR */
  421.  
  422. #ifdef GRASS              /* GRASS (geographic info system) monitor */
  423. #include "term/grass.trm"
  424. #endif /* GRASS */
  425.  
  426. #ifdef APOLLO           /* Apollo Graphics Primitive Resource (resizable window) */
  427. #include "term/apollo.trm"
  428. #endif /* APOLLO */
  429.  
  430. #ifdef IMAGEN        /* IMAGEN printer */
  431. #include "term/imagen.trm"
  432. #endif
  433.  
  434. #ifdef MIF            /* Framemaker MIF  driver */
  435. #include "term/mif.trm"
  436. #endif
  437.  
  438. #ifdef MF            /* METAFONT driver */
  439. #include "term/metafont.trm"
  440. #endif
  441.  
  442. #ifdef TEXDRAW
  443. #include "term/texdraw.trm"
  444. #endif
  445.  
  446. #ifdef EEPIC        /* EEPIC (LATEX) type */
  447. #include "term/eepic.trm"
  448. # ifndef LATEX
  449. #  define LATEX
  450. # endif
  451. #endif
  452.  
  453. #ifdef EMTEX        /* EMTEX (LATEX for PC) type */
  454. # ifndef LATEX
  455. #  define LATEX
  456. # endif
  457. #endif
  458.  
  459. #ifdef LATEX        /* LATEX type */
  460. #include "term/latex.trm"
  461. #endif
  462.  
  463. #ifdef GPIC        /* GPIC (groff) type */ 
  464. #include "term/gpic.trm"
  465. #endif
  466.  
  467. #ifdef PBM        /* PBMPLUS portable bitmap */
  468. #include "term/pbm.trm"
  469. #endif
  470.  
  471. #ifdef POSTSCRIPT    /* POSTSCRIPT type */
  472. #include "term/post.trm"
  473. #endif
  474.  
  475. #ifdef PRESCRIBE    /* PRESCRIBE type */
  476. #include "term/kyo.trm"
  477. #endif
  478.  
  479. /* note: this must come after term/post.trm */
  480. #ifdef PSLATEX        /* LaTeX with embedded PostScript */
  481. #include "term/pslatex.trm"
  482. #endif
  483.  
  484. #ifdef PSTRICKS
  485. #include "term/pstricks.trm"
  486. #endif
  487.  
  488. #ifdef TPIC        /* TPIC (LATEX) type */
  489. #include "term/tpic.trm"
  490. # ifndef LATEX
  491. #  define LATEX
  492. # endif
  493. #endif
  494.  
  495. #ifdef UNIXPC     /* unix-PC  ATT 7300 or 3b1 machine */
  496. #include "term/unixpc.trm"
  497. #endif /* UNIXPC */
  498.  
  499. #ifdef AED
  500. #include "term/aed.trm"
  501. #endif /* AED */
  502.  
  503. #ifdef AIFM
  504. #include "term/ai.trm"
  505. #endif /* AIFM */
  506.  
  507. #ifdef COREL
  508. #include "term/corel.trm"
  509. #endif /* COREL */
  510.  
  511. #ifdef CGI
  512. #include "term/cgi.trm"
  513. #endif /* CGI */
  514.  
  515. #ifdef DEBUG
  516. #include "term/debug.trm"
  517. #endif /* DEBUG */
  518.  
  519. #ifdef EXCL
  520. #include "term/excl.trm"
  521. #endif /* EXCL */
  522.  
  523. #ifdef HP2648
  524. /* also works for HP2647 */
  525. #include "term/hp2648.trm"
  526. #endif /* HP2648 */
  527.  
  528. #ifdef HP26
  529. #include "term/hp26.trm"
  530. #endif /* HP26 */
  531.  
  532. #ifdef HP75
  533. #ifndef HPGL
  534. #define HPGL
  535. #endif
  536. #endif
  537.  
  538. /* HPGL - includes HP75 and HPLJIII in HPGL mode */
  539. #ifdef HPGL
  540. #include "term/hpgl.trm"
  541. #endif /* HPGL */
  542.  
  543. /* Roland DXY800A plotter driver by Martin Yii, eln557h@monu3.OZ 
  544.     and Russell Lang, rjl@monu1.cc.monash.oz */
  545. #ifdef DXY800A
  546. #include "term/dxy.trm"
  547. #endif /* DXY800A */
  548.  
  549. #ifdef IRIS4D
  550. #include "term/iris4d.trm"
  551. #endif /* IRIS4D */
  552.  
  553. #ifdef NEXT
  554. #include "term/next.trm"
  555. #endif /* NEXT */
  556.  
  557. #ifdef QMS
  558. #include "term/qms.trm"
  559. #endif /* QMS */
  560.  
  561. #ifdef REGIS
  562. #include "term/regis.trm"
  563. #endif /* REGIS */
  564.  
  565. #ifdef RGIP
  566. #include "term/rgip.trm"
  567. #endif /* RGIP UNIPLEX */
  568.  
  569. #ifdef MGR
  570. #include "term/mgr.trm"
  571. #endif /* MGR */
  572.  
  573. #ifdef SUN
  574. #include "term/sun.trm"
  575. #endif /* SUN */
  576.  
  577. #ifdef VWS
  578. #include "term/vws.trm"
  579. #endif /* VWS */
  580.  
  581. #ifdef V384
  582. #include "term/v384.trm"
  583. #endif /* V384 */
  584.  
  585. #ifdef TGIF
  586. #include "term/tgif.trm"
  587. #endif /* TGIF */
  588.  
  589. #ifdef UNIXPLOT
  590. #ifdef GNUGRAPH
  591. #include "term/gnugraph.trm"
  592. #else
  593. #include "term/unixplot.trm"
  594. #endif /* GNUGRAPH */
  595. #endif /* UNIXPLOT */
  596.  
  597. #ifdef X11
  598. #include "term/x11.trm"
  599. #include "term/xlib.trm"
  600. #endif /* X11 */
  601.  
  602. #ifdef DXF
  603. #include "term/dxf.trm"
  604. #endif /* DXF */
  605.   
  606. #ifdef AMIGASCREEN
  607. #include "term/amiga.trm"
  608. #endif /* AMIGASCREEN */
  609.  
  610. #ifdef LINUX
  611. #include "term/linux.trm"
  612. #endif /* LINUX */
  613.  
  614. /* Dummy functions for unavailable features */
  615.  
  616. /* change angle of text.  0 is horizontal left to right.
  617. * 1 is vertical bottom to top (90 deg rotate)  
  618. */
  619. static int null_text_angle()
  620. {
  621. return FALSE ;    /* can't be done */
  622. }
  623.  
  624. /* change justification of text.  
  625.  * modes are LEFT (flush left), CENTRE (centred), RIGHT (flush right)
  626.  */
  627. static int null_justify_text()
  628. {
  629. return FALSE ;    /* can't be done */
  630. }
  631.  
  632.  
  633. /* Change scale of plot.
  634.  * Parameters are x,y scaling factors for this plot.
  635.  * Some terminals (eg latex) need to do scaling themselves.
  636.  */
  637. static int null_scale()
  638. {
  639. return FALSE ;    /* can't be done */
  640. }
  641.  
  642. static int do_scale()
  643. {
  644. return TRUE ;    /* can be done */
  645. }
  646.  
  647. options_null()
  648. {
  649.     term_options[0] = '\0';    /* we have no options */
  650. }
  651.  
  652. static UNKNOWN_null()
  653. {
  654. }
  655.  
  656. /*
  657.  * term_tbl[] contains an entry for each terminal.  "unknown" must be the
  658.  *   first, since term is initialized to 0.
  659.  */
  660. struct termentry term_tbl[] = {
  661.     {"unknown", "Unknown terminal type - not a plotting device",
  662.       100, 100, 1, 1,
  663.       1, 1, options_null, UNKNOWN_null, UNKNOWN_null, 
  664.       UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, 
  665.       UNKNOWN_null, UNKNOWN_null, null_text_angle, 
  666.       null_justify_text, UNKNOWN_null, UNKNOWN_null}
  667.  
  668.     ,{"table", "Dump ASCII table of X Y [Z] values to output",
  669.       100, 100, 1, 1,
  670.       1, 1, options_null, UNKNOWN_null, UNKNOWN_null, 
  671.       UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, 
  672.       UNKNOWN_null, UNKNOWN_null, null_text_angle, 
  673.       null_justify_text, UNKNOWN_null, UNKNOWN_null}
  674.  
  675. #ifdef AMIGASCREEN
  676.     ,{"amiga", "Amiga Custom Screen",
  677.        AMIGA_XMAX, AMIGA_YMAX, AMIGA_VCHAR, AMIGA_HCHAR, 
  678.        AMIGA_VTIC, AMIGA_HTIC, options_null, AMIGA_init, AMIGA_reset, 
  679.        AMIGA_text, null_scale, AMIGA_graphics, AMIGA_move, AMIGA_vector,
  680.        AMIGA_linetype, AMIGA_put_text, null_text_angle, 
  681.        AMIGA_justify_text, do_point, do_arrow}
  682. #endif
  683.  
  684. #ifdef ATARI
  685.     ,{"atari", "Atari ST/TT",
  686.        ATARI_XMAX, ATARI_YMAX, ATARI_VCHAR, ATARI_HCHAR, 
  687.        ATARI_VTIC, ATARI_HTIC, ATARI_options, ATARI_init, ATARI_reset, 
  688.        ATARI_text, null_scale, ATARI_graphics, ATARI_move, ATARI_vector, 
  689.        ATARI_linetype, ATARI_put_text, ATARI_text_angle, 
  690.        null_justify_text, ATARI_point, do_arrow}
  691. #endif
  692.  
  693. #ifdef DUMB
  694.     ,{"dumb", "printer or glass dumb terminal",
  695.          DUMB_XMAX, DUMB_YMAX, 1, 1,
  696.          1, 1, DUMB_options, DUMB_init, DUMB_reset,
  697.          DUMB_text, null_scale, DUMB_graphics, DUMB_move, DUMB_vector,
  698.          DUMB_linetype, DUMB_put_text, null_text_angle,
  699.          null_justify_text, DUMB_point, DUMB_arrow}
  700. #endif
  701.  
  702. #ifdef PC
  703. #ifndef _Windows
  704. # ifdef __TURBOC__
  705. #ifdef ATT6300
  706.     ,{"att", "IBM PC/Clone with AT&T 6300 graphics board",
  707.        ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  708.        ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  709.        ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  710.        ATT_linetype, ATT_put_text, ATT_text_angle, 
  711.        ATT_justify_text, line_and_point, do_arrow}
  712. #endif
  713.  
  714.     ,{"cga", "IBM PC/Clone with CGA graphics board",
  715.        CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  716.        CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  717.        CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  718.        CGA_linetype, CGA_put_text, MCGA_text_angle, 
  719.        CGA_justify_text, line_and_point, do_arrow}
  720.  
  721.     ,{"egalib", "IBM PC/Clone with EGA graphics board",
  722.        EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  723.        EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  724.        EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  725.        EGALIB_linetype, EGALIB_put_text, EGALIB_text_angle, 
  726.        EGALIB_justify_text, do_point, do_arrow}
  727.  
  728.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  729.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  730.        HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  731.        HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  732.        HERC_linetype, HERC_put_text, MCGA_text_angle, 
  733.        HERC_justify_text, line_and_point, do_arrow}
  734.  
  735.     ,{"mcga", "IBM PC/Clone with MCGA graphics board",
  736.        MCGA_XMAX, MCGA_YMAX, MCGA_VCHAR, MCGA_HCHAR,
  737.        MCGA_VTIC, MCGA_HTIC, options_null, MCGA_init, MCGA_reset,
  738.        MCGA_text, null_scale, MCGA_graphics, MCGA_move, MCGA_vector,
  739.        MCGA_linetype, MCGA_put_text, MCGA_text_angle, 
  740.        MCGA_justify_text, line_and_point, do_arrow}
  741.  
  742.     ,{"svga", "IBM PC/Clone with Super VGA graphics board",
  743.        SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
  744.        SVGA_VTIC, SVGA_HTIC, options_null, SVGA_init, SVGA_reset,
  745.        SVGA_text, null_scale, SVGA_graphics, SVGA_move, SVGA_vector,
  746.        SVGA_linetype, SVGA_put_text, SVGA_text_angle, 
  747.        SVGA_justify_text, do_point, do_arrow}
  748.  
  749.     ,{"vgalib", "IBM PC/Clone with VGA graphics board",
  750.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  751.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  752.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  753.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  754.        VGA_justify_text, do_point, do_arrow}
  755.  
  756.     ,{"vgamono", "IBM PC/Clone with VGA Monochrome graphics board",
  757.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  758.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  759.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  760.        VGAMONO_linetype, VGA_put_text, VGA_text_angle, 
  761.        VGA_justify_text, line_and_point, do_arrow}
  762. #else                    /* TURBO */
  763.  
  764. #ifdef ATT6300
  765.     ,{"att", "AT&T PC/6300 graphics",
  766.        ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  767.        ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  768.        ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  769.        ATT_linetype, ATT_put_text, ATT_text_angle, 
  770.        null_justify_text, line_and_point, do_arrow}
  771. #endif
  772.  
  773.     ,{"cga", "IBM PC/Clone with CGA graphics board",
  774.        CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  775.        CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  776.        CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  777.        CGA_linetype, CGA_put_text, CGA_text_angle, 
  778.        null_justify_text, line_and_point, do_arrow}
  779.  
  780. #ifdef CORONA
  781.     ,{"corona325", "Corona graphics ???",
  782.        COR_XMAX, COR_YMAX, COR_VCHAR, COR_HCHAR,
  783.        COR_VTIC, COR_HTIC, options_null, COR_init, COR_reset,
  784.        COR_text, null_scale, COR_graphics, COR_move, COR_vector,
  785.        COR_linetype, COR_put_text, COR_text_angle, 
  786.        null_justify_text, line_and_point, do_arrow}
  787. #endif                    /* CORONA */
  788.  
  789.     ,{"egabios", "IBM PC/Clone with EGA graphics board (BIOS)",
  790.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  791.        EGA_VTIC, EGA_HTIC, options_null, EGA_init, EGA_reset,
  792.        EGA_text, null_scale, EGA_graphics, EGA_move, EGA_vector,
  793.        EGA_linetype, EGA_put_text, EGA_text_angle, 
  794.        null_justify_text, do_point, do_arrow}
  795.  
  796. #ifdef EGALIB
  797.     ,{"egalib", "IBM PC/Clone with EGA graphics board (LIB)",
  798.        EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  799.        EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  800.        EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  801.        EGALIB_linetype, EGALIB_put_text, null_text_angle, 
  802.        null_justify_text, do_point, do_arrow}
  803. #endif
  804.  
  805. #ifdef HERCULES
  806.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  807.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  808.        HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  809.        HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  810.        HERC_linetype, HERC_put_text, HERC_text_angle, 
  811.        null_justify_text, line_and_point, do_arrow}
  812. #endif                    /* HERCULES */
  813.  
  814.     ,{"vgabios", "IBM PC/Clone with VGA graphics board (BIOS)",
  815.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  816.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  817.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  818.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  819.        null_justify_text, do_point, do_arrow}
  820.  
  821. #endif                    /* TURBO */
  822. #endif                    /* _Windows */
  823. #endif                    /* PC */
  824.  
  825. #ifdef __ZTC__         /* zortech C flashgraphics for 386 */
  826.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  827.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  828.        HERC_VTIC, HERC_HTIC, options_null, VGA_init, VGA_reset,
  829.        VGA_text, null_scale, HERC_graphics, VGA_move, VGA_vector,
  830.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  831.        VGA_justify_text, do_point, do_arrow}
  832.  
  833.     ,{"egamono", "IBM PC/Clone with monochrome EGA graphics board",
  834.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  835.        EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
  836.        VGA_text, null_scale, EGAMONO_graphics, VGA_move, VGA_vector,
  837.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  838.        VGA_justify_text, do_point, do_arrow}
  839.  
  840.     ,{"egalib", "IBM PC/Clone with color EGA graphics board",
  841.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  842.        EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
  843.        VGA_text, null_scale, EGA_graphics, VGA_move, VGA_vector,
  844.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  845.        VGA_justify_text, do_point, do_arrow}
  846.  
  847.     ,{"vgalib", "IBM PC/Clone with VGA graphics board",
  848.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  849.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  850.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  851.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  852.        VGA_justify_text, do_point, do_arrow}
  853.  
  854.     ,{"vgamono", "IBM PC/Clone with monochrome VGA graphics board",
  855.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  856.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  857.        VGA_text, null_scale, VGAMONO_graphics, VGA_move, VGA_vector,
  858.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  859.        VGA_justify_text, do_point, do_arrow}
  860.  
  861.     ,{"svgalib", "IBM PC/Clone with VESA Super VGA graphics board",
  862.        SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
  863.        SVGA_VTIC, SVGA_HTIC, options_null, VGA_init, VGA_reset,
  864.        VGA_text, null_scale, SVGA_graphics, VGA_move, VGA_vector,
  865.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  866.        VGA_justify_text, do_point, do_arrow}
  867.  
  868.     ,{"ssvgalib", "IBM PC/Clone with VESA 256 color 1024 by 768 super VGA",
  869.        SSVGA_XMAX, SSVGA_YMAX, SSVGA_VCHAR, SSVGA_HCHAR,
  870.        SSVGA_VTIC, SSVGA_HTIC, options_null, VGA_init, VGA_reset,
  871.        VGA_text, null_scale, SSVGA_graphics, VGA_move, VGA_vector,
  872.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  873.        VGA_justify_text, do_point, do_arrow}
  874. #endif    /* __ZTC__ */
  875.  
  876. #ifdef AED
  877.     ,{"aed512", "AED 512 Terminal",
  878.        AED5_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  879.        AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  880.        AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  881.        AED_linetype, AED_put_text, null_text_angle, 
  882.        null_justify_text, do_point, do_arrow}
  883.     ,{"aed767", "AED 767 Terminal",
  884.        AED_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  885.        AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  886.        AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  887.        AED_linetype, AED_put_text, null_text_angle, 
  888.        null_justify_text, do_point, do_arrow}
  889. #endif
  890.  
  891. #ifdef AIFM
  892.     ,{"aifm", "Adobe Illustrator 3.0 Format",
  893.        AI_XMAX, AI_YMAX, AI_VCHAR, AI_HCHAR, 
  894.        AI_VTIC, AI_HTIC, AI_options, AI_init, AI_reset, 
  895.        AI_text, null_scale, AI_graphics, AI_move, AI_vector, 
  896.        AI_linetype, AI_put_text, AI_text_angle, 
  897.        AI_justify_text, do_point, do_arrow}
  898. #endif
  899.  
  900. #ifdef APOLLO
  901.        ,{"apollo", "Apollo Graphics Primitive Resource, rescaling of subsequent plots after window resizing",
  902.        0, 0, 0, 0, /* APOLLO_XMAX, APOLLO_YMAX, APOLLO_VCHAR, APOLLO_HCHAR, are filled in at run-time */
  903.        APOLLO_VTIC, APOLLO_HTIC, options_null, APOLLO_init, APOLLO_reset,
  904.        APOLLO_text, null_scale, APOLLO_graphics, APOLLO_move, APOLLO_vector,
  905.        APOLLO_linetype, APOLLO_put_text, APOLLO_text_angle,
  906.        APOLLO_justify_text, line_and_point, do_arrow}
  907. #endif
  908.  
  909. #ifdef GPR
  910.        ,{"gpr", "Apollo Graphics Primitive Resource, fixed-size window",
  911.        GPR_XMAX, GPR_YMAX, GPR_VCHAR, GPR_HCHAR,
  912.        GPR_VTIC, GPR_HTIC, options_null, GPR_init, GPR_reset,
  913.        GPR_text, null_scale, GPR_graphics, GPR_move, GPR_vector,
  914.        GPR_linetype, GPR_put_text, GPR_text_angle,
  915.        GPR_justify_text, line_and_point, do_arrow}
  916. #endif
  917.  
  918. #ifdef BITGRAPH
  919.     ,{"bitgraph", "BBN Bitgraph Terminal",
  920.        BG_XMAX,BG_YMAX,BG_VCHAR, BG_HCHAR, 
  921.        BG_VTIC, BG_HTIC, options_null, BG_init, BG_reset, 
  922.        BG_text, null_scale, BG_graphics, BG_move, BG_vector,
  923.        BG_linetype, BG_put_text, null_text_angle, 
  924.        null_justify_text, line_and_point, do_arrow}
  925. #endif
  926.  
  927. #ifdef COREL
  928.     ,{"corel","EPS format for CorelDRAW",
  929.      CORELD_XMAX, CORELD_YMAX, CORELD_VCHAR, CORELD_HCHAR,
  930.      CORELD_VTIC, CORELD_HTIC, COREL_options, COREL_init, COREL_reset,
  931.      COREL_text, null_scale, COREL_graphics, COREL_move, COREL_vector,
  932.      COREL_linetype, COREL_put_text, COREL_text_angle,
  933.      COREL_justify_text, do_point, do_arrow}
  934. #endif
  935.  
  936. #ifdef CGI
  937.     ,{"cgi", "SCO CGI drivers (requires CGIDISP or CGIPRNT env variable)",
  938.        CGI_XMAX, CGI_YMAX, 0, 0, 
  939.        CGI_VTIC, 0, options_null, CGI_init, CGI_reset, 
  940.        CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  941.        CGI_linetype, CGI_put_text, CGI_text_angle, 
  942.        CGI_justify_text, CGI_point, do_arrow}
  943.  
  944.     ,{"hcgi", "SCO CGI drivers (hardcopy, requires CGIPRNT env variable)",
  945.        CGI_XMAX, CGI_YMAX, 0, 0, 
  946.        CGI_VTIC, 0, options_null, HCGI_init, CGI_reset, 
  947.        CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  948.        CGI_linetype, CGI_put_text, CGI_text_angle, 
  949.        CGI_justify_text, CGI_point, do_arrow}
  950. #endif
  951.  
  952. #ifdef DEBUG
  953.     ,{"debug", "debugging driver",
  954.        DEBUG_XMAX, DEBUG_YMAX, DEBUG_VCHAR, DEBUG_HCHAR,
  955.        DEBUG_VTIC, DEBUG_HTIC, options_null, DEBUG_init, DEBUG_reset,
  956.        DEBUG_text, null_scale, DEBUG_graphics, DEBUG_move, DEBUG_vector,
  957.        DEBUG_linetype, DEBUG_put_text, null_text_angle, 
  958.        DEBUG_justify_text, line_and_point, do_arrow}
  959. #endif
  960.  
  961. #ifdef DJSVGA
  962.     ,{"svga", "IBM PC/Clone with Super VGA graphics board",
  963.        DJSVGA_XMAX, DJSVGA_YMAX, DJSVGA_VCHAR, DJSVGA_HCHAR,
  964.        DJSVGA_VTIC, DJSVGA_HTIC, options_null, DJSVGA_init, DJSVGA_reset,
  965.        DJSVGA_text, null_scale, DJSVGA_graphics, DJSVGA_move, DJSVGA_vector,
  966.        DJSVGA_linetype, DJSVGA_put_text, null_text_angle, 
  967.        null_justify_text, do_point, do_arrow}
  968. #endif
  969.  
  970. #ifdef DXF
  971.     ,{"dxf", "dxf-file for AutoCad (default size 120x80)",
  972.        DXF_XMAX,DXF_YMAX,DXF_VCHAR, DXF_HCHAR,
  973.        DXF_VTIC, DXF_HTIC, options_null,DXF_init, DXF_reset,
  974.        DXF_text, null_scale, DXF_graphics, DXF_move, DXF_vector,
  975.        DXF_linetype, DXF_put_text, DXF_text_angle,
  976.        DXF_justify_text, do_point, do_arrow}
  977. #endif
  978.  
  979. #ifdef DXY800A
  980.     ,{"dxy800a", "Roland DXY800A plotter",
  981.        DXY_XMAX, DXY_YMAX, DXY_VCHAR, DXY_HCHAR,
  982.        DXY_VTIC, DXY_HTIC, options_null, DXY_init, DXY_reset,
  983.        DXY_text, null_scale, DXY_graphics, DXY_move, DXY_vector,
  984.        DXY_linetype, DXY_put_text, DXY_text_angle, 
  985.        null_justify_text, do_point, do_arrow}
  986. #endif
  987.  
  988. #ifdef EEPIC
  989.     ,{"eepic", "EEPIC -- extended LaTeX picture environment",
  990.        EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR, 
  991.        EEPIC_VTIC, EEPIC_HTIC, options_null, EEPIC_init, EEPIC_reset, 
  992.        EEPIC_text, EEPIC_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector, 
  993.        EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle, 
  994.        EEPIC_justify_text, EEPIC_point, EEPIC_arrow}
  995. #endif
  996.  
  997. #ifdef EMTEX
  998.     ,{"emtex", "LaTeX picture environment with emTeX specials",
  999.        LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  1000.        LATEX_VTIC, LATEX_HTIC, LATEX_options, EMTEX_init, EMTEX_reset, 
  1001.        EMTEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  1002.        LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  1003.        LATEX_justify_text, LATEX_point, LATEX_arrow}
  1004. #endif
  1005.  
  1006. #ifdef EPS180
  1007.     ,{"epson_180dpi", "Epson LQ-style 180-dot per inch (24 pin) printers",
  1008.        EPS180XMAX, EPS180YMAX, EPSON180VCHAR, EPSON180HCHAR,
  1009.        EPSON180VTIC, EPSON180HTIC, options_null, EPSONinit, EPSONreset,
  1010.        EPS180text, null_scale, EPS180graphics, EPSONmove, EPSONvector,
  1011.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1012.        null_justify_text, do_point, do_arrow}
  1013. #endif
  1014.  
  1015. #ifdef EPS60
  1016.     ,{"epson_60dpi", "Epson-style 60-dot per inch printers",
  1017.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1018.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1019.        EPS60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1020.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1021.        null_justify_text, do_point, do_arrow}
  1022. #endif
  1023.  
  1024. #ifdef EPSONP
  1025.     ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...",
  1026.        EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR, 
  1027.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset, 
  1028.        EPSONtext, null_scale, EPSONgraphics, EPSONmove, EPSONvector, 
  1029.        EPSONlinetype, EPSONput_text, EPSON_text_angle, 
  1030.        null_justify_text, line_and_point, do_arrow}
  1031. #endif
  1032.  
  1033. #ifdef EXCL
  1034.     ,{"excl", "Talaris EXCL Laser printer (also Talaris 1590 and others)",
  1035.        EXCL_XMAX,EXCL_YMAX, EXCL_VCHAR, EXCL_HCHAR, 
  1036.        EXCL_VTIC, EXCL_HTIC, options_null, EXCL_init,EXCL_reset, 
  1037.        EXCL_text, null_scale, EXCL_graphics, EXCL_move, EXCL_vector,
  1038.        EXCL_linetype,EXCL_put_text, null_text_angle, 
  1039.        null_justify_text, line_and_point, do_arrow}
  1040. #endif
  1041.  
  1042.  
  1043. #ifdef FIG
  1044.     ,{"fig", "FIG 2.1 graphics language: SunView or X graphics editor",
  1045.        FIG_XMAX, FIG_YMAX, FIG_VCHAR, FIG_HCHAR, 
  1046.        FIG_VTIC, FIG_HTIC, FIG_options, FIG_init, FIG_reset, 
  1047.        FIG_text, null_scale, FIG_graphics, FIG_move, FIG_vector, 
  1048.        FIG_linetype, FIG_put_text, FIG_text_angle, 
  1049.        FIG_justify_text, line_and_point, FIG_arrow}
  1050.     ,{"bfig", "FIG 2.1 graphics lang: SunView or X graphics editor. Large Graph",
  1051.        BFIG_XMAX, BFIG_YMAX, BFIG_VCHAR, BFIG_HCHAR, 
  1052.        BFIG_VTIC, BFIG_HTIC, FIG_options, FIG_init, FIG_reset, 
  1053.        FIG_text, null_scale, FIG_graphics, FIG_move, BFIG_vector, 
  1054.        FIG_linetype, BFIG_put_text, FIG_text_angle, 
  1055.        FIG_justify_text, line_and_point, BFIG_arrow}
  1056. #endif
  1057.  
  1058. #ifdef GPIC
  1059.     ,{"gpic", "GPIC -- Produce graphs in groff using the gpic preprocessor",
  1060.        GPIC_XMAX, GPIC_YMAX, GPIC_VCHAR, GPIC_HCHAR, 
  1061.        GPIC_VTIC, GPIC_HTIC, GPIC_options, GPIC_init, GPIC_reset, 
  1062.        GPIC_text, GPIC_scale, GPIC_graphics, GPIC_move, GPIC_vector, 
  1063.        GPIC_linetype, GPIC_put_text, GPIC_text_angle, 
  1064.        GPIC_justify_text, line_and_point, GPIC_arrow}
  1065. #endif
  1066.  
  1067. #ifdef GRASS
  1068.     ,{"grass", "GRASS Graphics Monitor",
  1069.            GRASS_XMAX, GRASS_YMAX, GRASS_VCHAR, GRASS_HCHAR,
  1070.            GRASS_VTIC, GRASS_HTIC, GRASS_options, GRASS_init, GRASS_reset,
  1071.            GRASS_text, null_scale, GRASS_graphics, GRASS_move, GRASS_vector,
  1072.            GRASS_linetype, GRASS_put_text, GRASS_text_angle,
  1073.            GRASS_justify_text, GRASS_point, GRASS_arrow}
  1074. #endif
  1075.  
  1076. #ifdef HP26
  1077.     ,{"hp2623A", "HP2623A and maybe others",
  1078.        HP26_XMAX, HP26_YMAX, HP26_VCHAR, HP26_HCHAR,
  1079.        HP26_VTIC, HP26_HTIC, options_null, HP26_init, HP26_reset,
  1080.        HP26_text, null_scale, HP26_graphics, HP26_move, HP26_vector,
  1081.        HP26_linetype, HP26_put_text, HP26_text_angle, 
  1082.        null_justify_text, HP26_line_and_point, do_arrow}
  1083. #endif
  1084.  
  1085. #ifdef HP2648
  1086.     ,{"hp2648", "HP2648 and HP2647",
  1087.        HP2648XMAX, HP2648YMAX, HP2648VCHAR, HP2648HCHAR, 
  1088.        HP2648VTIC, HP2648HTIC, options_null, HP2648init, HP2648reset, 
  1089.        HP2648text, null_scale, HP2648graphics, HP2648move, HP2648vector, 
  1090.        HP2648linetype, HP2648put_text, HP2648_text_angle, 
  1091.        null_justify_text, line_and_point, do_arrow}
  1092. #endif
  1093.  
  1094. #ifdef HP75
  1095.     ,{"hp7580B", "HP7580, and probably other HPs (4 pens)",
  1096.        HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1097.        HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1098.        HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1099.        HP75_linetype, HPGL_put_text, HPGL_text_angle, 
  1100.        null_justify_text, do_point, do_arrow}
  1101. #endif
  1102.  
  1103. #ifdef HP500C
  1104.       ,{"hp500c", "HP DeskJet 500c, [75 100 150 300] [rle tiff]",
  1105.        HP500C_75PPI_XMAX, HP500C_75PPI_YMAX, HP500C_75PPI_VCHAR,
  1106.        HP500C_75PPI_HCHAR, HP500C_75PPI_VTIC, HP500C_75PPI_HTIC, HP500Coptions,
  1107.        HP500Cinit, HP500Creset, HP500Ctext, null_scale,
  1108.        HP500Cgraphics, HP500Cmove, HP500Cvector, HP500Clinetype,
  1109.        HP500Cput_text, HP500Ctext_angle, null_justify_text, do_point,
  1110.        do_arrow}
  1111. #endif
  1112.  
  1113. #ifdef HPGL
  1114.     ,{"hpgl", "HP7475 and (hopefully) lots of others (6 pens)",
  1115.        HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1116.        HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1117.        HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1118.        HPGL_linetype, HPGL_put_text, HPGL_text_angle, 
  1119.        null_justify_text, do_point, do_arrow}
  1120. #endif
  1121.  
  1122. #ifdef HPLJII
  1123.     ,{"hpljii", "HP Laserjet series II, [75 100 150 300]",
  1124.        HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1125.        HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1126.        HPLJIIinit, HPLJIIreset, HPLJIItext, null_scale,
  1127.        HPLJIIgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1128.        HPLJIIput_text, HPLJIItext_angle, null_justify_text, line_and_point,
  1129.        do_arrow}
  1130.     ,{"hpdj", "HP DeskJet 500, [75 100 150 300]",
  1131.        HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1132.        HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1133.        HPLJIIinit, HPLJIIreset, HPDJtext, null_scale,
  1134.        HPDJgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1135.        HPDJput_text, HPDJtext_angle, null_justify_text, line_and_point,
  1136.        do_arrow}
  1137. #endif
  1138.  
  1139. #ifdef HPPJ
  1140.     ,{"hppj", "HP PaintJet and HP3630 [FNT5X9 FNT9X17 FNT13X25]",
  1141.        HPPJ_XMAX, HPPJ_YMAX,
  1142.        HPPJ_9x17_VCHAR, HPPJ_9x17_HCHAR, HPPJ_9x17_VTIC, HPPJ_9x17_HTIC,
  1143.        HPPJoptions, HPPJinit, HPPJreset, HPPJtext, null_scale, HPPJgraphics,
  1144.        HPPJmove, HPPJvector, HPPJlinetype, HPPJput_text, HPPJtext_angle,
  1145.        null_justify_text, do_point, do_arrow}
  1146. #endif
  1147.  
  1148. #ifdef IMAGEN
  1149.     ,{"imagen", "Imagen laser printer",
  1150.        IMAGEN_XMAX, IMAGEN_YMAX, IMAGEN_VCHAR, IMAGEN_HCHAR, 
  1151.        IMAGEN_VTIC, IMAGEN_HTIC, options_null, IMAGEN_init, IMAGEN_reset, 
  1152.        IMAGEN_text, null_scale, IMAGEN_graphics, IMAGEN_move, 
  1153.        IMAGEN_vector, IMAGEN_linetype, IMAGEN_put_text, IMAGEN_text_angle,
  1154.        IMAGEN_justify_text, line_and_point, do_arrow}
  1155. #endif
  1156.  
  1157. #ifdef IRIS4D
  1158.     ,{"iris4d", "Silicon Graphics IRIS 4D Series Computer",
  1159.        IRIS4D_XMAX, IRIS4D_YMAX, IRIS4D_VCHAR, IRIS4D_HCHAR, 
  1160.        IRIS4D_VTIC, IRIS4D_HTIC, IRIS4D_options, IRIS4D_init, IRIS4D_reset, 
  1161.        IRIS4D_text, null_scale, IRIS4D_graphics, IRIS4D_move, IRIS4D_vector,
  1162.        IRIS4D_linetype, IRIS4D_put_text, null_text_angle, 
  1163.        null_justify_text, do_point, do_arrow}
  1164. #endif
  1165.  
  1166. #ifdef KERMIT
  1167.     ,{"kc_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - color",
  1168.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1169.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1170.        KTEK40Ctext, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1171.        KTEK40Clinetype, TEK40put_text, null_text_angle, 
  1172.        null_justify_text, do_point, do_arrow}
  1173.     ,{"km_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - monochrome",
  1174.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1175.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1176.        TEK40text, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1177.        KTEK40Mlinetype, TEK40put_text, null_text_angle, 
  1178.        null_justify_text, line_and_point, do_arrow}
  1179. #endif
  1180.  
  1181. #ifdef LATEX
  1182.     ,{"latex", "LaTeX picture environment",
  1183.        LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  1184.        LATEX_VTIC, LATEX_HTIC, LATEX_options, LATEX_init, LATEX_reset, 
  1185.        LATEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  1186.        LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  1187.        LATEX_justify_text, LATEX_point, LATEX_arrow}
  1188. #endif
  1189.  
  1190. #ifdef LN03P
  1191.      ,{"ln03", "LN03-plus laser printer in tektronix (EGM) mode",
  1192.     LN03PXMAX, LN03PYMAX, LN03PVCHAR, LN03PHCHAR,
  1193.     LN03PVTIC, LN03PHTIC, options_null, LN03Pinit, LN03Preset,
  1194.     LN03Ptext, null_scale, TEK40graphics, LN03Pmove, LN03Pvector,
  1195.     LN03Plinetype, LN03Pput_text, null_text_angle,
  1196.     null_justify_text, line_and_point, do_arrow}
  1197. #endif
  1198.  
  1199. #ifdef MF
  1200.     ,{"mf", "Metafont plotting standard",
  1201.        MF_XMAX, MF_YMAX, MF_VCHAR, MF_HCHAR, 
  1202.        MF_VTIC, MF_HTIC, options_null, MF_init, MF_reset, 
  1203.        MF_text, MF_scale, MF_graphics, MF_move, MF_vector, 
  1204.        MF_linetype, MF_put_text, MF_text_angle, 
  1205.        MF_justify_text, line_and_point, MF_arrow}
  1206. #endif
  1207.  
  1208. #ifdef MGR
  1209.     ,{"mgr", "Mgr window system",
  1210.     /* dimensions nominal, replaced during MGR_graphics call */
  1211.        MGR_XMAX, MGR_YMAX, MGR_VCHAR, MGR_HCHAR, 
  1212.        MGR_VTIC, MGR_HTIC, options_null, MGR_init, MGR_reset, 
  1213.        MGR_text, null_scale, MGR_graphics, MGR_move, MGR_vector,
  1214.        MGR_linetype, MGR_put_text, null_text_angle, 
  1215.        null_justify_text, do_point, do_arrow}
  1216. #endif
  1217.  
  1218. #ifdef MIF
  1219.     ,{"mif", "Frame maker MIF 3.00 format",
  1220.           MIF_XMAX, MIF_YMAX, MIF_VCHAR, MIF_HCHAR, 
  1221.          MIF_VTIC, MIF_HTIC, MIF_options, MIF_init, MIF_reset, 
  1222.         MIF_text, null_scale, MIF_graphics, MIF_move, MIF_vector, 
  1223.         MIF_linetype, MIF_put_text, MIF_text_angle, 
  1224.         MIF_justify_text, line_and_point, do_arrow}
  1225. #endif
  1226.  
  1227. #ifdef NEC
  1228.     ,{"nec_cp6", "NEC printer CP6, Epson LQ-800 [monocrome color draft]",
  1229.        NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  1230.        NECVTIC, NECHTIC, NECoptions, NECinit, NECreset, 
  1231.        NECtext, null_scale, NECgraphics, NECmove, NECvector, 
  1232.        NEClinetype, NECput_text, NEC_text_angle, 
  1233.        null_justify_text, line_and_point, do_arrow}
  1234. #endif
  1235.  
  1236. #ifdef NEXT
  1237.     ,{"next", "NeXTstep window system",
  1238.        NEXT_XMAX, NEXT_YMAX, NEXT_VCHAR, NEXT_HCHAR, 
  1239.        NEXT_VTIC, NEXT_HTIC, NEXT_options, NEXT_init, NEXT_reset, 
  1240.        NEXT_text, do_scale, NEXT_graphics, NEXT_move, NEXT_vector, 
  1241.        NEXT_linetype, NEXT_put_text, NEXT_text_angle, 
  1242.        NEXT_justify_text, NEXT_point, do_arrow}
  1243. #endif /* The PostScript driver with NXImage displaying the PostScript on screen */
  1244.  
  1245. #ifdef OKIDATA
  1246.     ,{"okidata", "OKIDATA 320/321 Standard",
  1247.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1248.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1249.        OKIDATAtext, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1250.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1251.        null_justify_text, do_point, do_arrow}
  1252. #endif
  1253.  
  1254. #ifdef OS2PM
  1255.     ,{"pm", "OS/2 Presentation Manager",
  1256.        PM_XMAX, PM_YMAX, PM_VCHAR, PM_HCHAR, 
  1257.        PM_VTIC, PM_HTIC, PM_args, PM_init, PM_reset, 
  1258.        PM_text, null_scale, PM_graphics, PM_move, PM_vector,
  1259.        PM_linetype, PM_put_text, PM_text_angle, 
  1260.        PM_justify_text, PM_point, do_arrow}
  1261. #endif
  1262.  
  1263. #ifdef PBM
  1264.     ,{"pbm", "Portable bitmap [small medium large] [monochrome gray color]",
  1265.        PBM_XMAX, PBM_YMAX, PBM_VCHAR,
  1266.        PBM_HCHAR, PBM_VTIC, PBM_HTIC, PBMoptions,
  1267.        PBMinit, PBMreset, PBMtext, null_scale,
  1268.        PBMgraphics, PBMmove, PBMvector, PBMlinetype,
  1269.        PBMput_text, PBMtext_angle, null_justify_text, PBMpoint,
  1270.        do_arrow}
  1271. #endif
  1272.  
  1273. #ifdef PCL
  1274.  ,{"pcl5", "HP LaserJet III [mode] [font] [point]",
  1275.    PCL_XMAX, PCL_YMAX, HPGL2_VCHAR, HPGL2_HCHAR,
  1276.    PCL_VTIC, PCL_HTIC, PCL_options, PCL_init, PCL_reset,
  1277.    PCL_text, null_scale, PCL_graphics, HPGL2_move, HPGL2_vector,
  1278.    HPGL2_linetype, HPGL2_put_text, HPGL2_text_angle,
  1279.    HPGL2_justify_text, do_point, do_arrow}
  1280. #endif
  1281.  
  1282. #ifdef POSTSCRIPT
  1283.     ,{"postscript", "PostScript graphics language [mode \042fontname\042 font_size]",
  1284.        PS_XMAX, PS_YMAX, PS_VCHAR, PS_HCHAR, 
  1285.        PS_VTIC, PS_HTIC, PS_options, PS_init, PS_reset, 
  1286.        PS_text, null_scale, PS_graphics, PS_move, PS_vector, 
  1287.        PS_linetype, PS_put_text, PS_text_angle, 
  1288.        PS_justify_text, PS_point, do_arrow}
  1289. #endif
  1290.  
  1291. #ifdef PRESCRIBE
  1292.     ,{"prescribe", "Prescribe - for the Kyocera Laser Printer",
  1293.     PRE_XMAX, PRE_YMAX, PRE_VCHAR, PRE_HCHAR, 
  1294.     PRE_VTIC, PRE_HTIC, options_null, PRE_init, PRE_reset, 
  1295.     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1296.     PRE_linetype, PRE_put_text, null_text_angle, 
  1297.     PRE_justify_text, line_and_point, do_arrow}
  1298.     ,{"kyo", "Kyocera Laser Printer with Courier font",
  1299.     PRE_XMAX, PRE_YMAX, KYO_VCHAR, KYO_HCHAR, 
  1300.     PRE_VTIC, PRE_HTIC, options_null, KYO_init, PRE_reset, 
  1301.     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1302.     PRE_linetype, PRE_put_text, null_text_angle, 
  1303.     PRE_justify_text, line_and_point, do_arrow}
  1304. #endif /* PRESCRIBE */
  1305.  
  1306. #ifdef PSLATEX
  1307.     ,{"pslatex", "LaTeX picture environment with PostScript \\specials",
  1308.     PS_XMAX, PS_YMAX, PSLATEX_VCHAR, PSLATEX_HCHAR,
  1309.     PS_VTIC, PS_HTIC, PSLATEX_options, PSLATEX_init, PSLATEX_reset,
  1310.     PSLATEX_text, PSLATEX_scale, PSLATEX_graphics, PS_move, PS_vector,
  1311.     PS_linetype, PSLATEX_put_text, PSLATEX_text_angle,
  1312.     PSLATEX_justify_text, PS_point, do_arrow}
  1313. #endif
  1314.  
  1315. #ifdef    PSTRICKS
  1316.     ,{"pstricks", "LaTeX picture environment with PSTricks macros",
  1317.        PSTRICKS_XMAX, PSTRICKS_YMAX, PSTRICKS_VCHAR, PSTRICKS_HCHAR, 
  1318.        PSTRICKS_VTIC, PSTRICKS_HTIC, options_null, PSTRICKS_init, PSTRICKS_reset, 
  1319.        PSTRICKS_text, PSTRICKS_scale, PSTRICKS_graphics, PSTRICKS_move, PSTRICKS_vector, 
  1320.        PSTRICKS_linetype, PSTRICKS_put_text, PSTRICKS_text_angle, 
  1321.        PSTRICKS_justify_text, PSTRICKS_point, PSTRICKS_arrow}
  1322. #endif
  1323.     
  1324. #ifdef QMS
  1325.     ,{"qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
  1326.        QMS_XMAX,QMS_YMAX, QMS_VCHAR, QMS_HCHAR, 
  1327.        QMS_VTIC, QMS_HTIC, options_null, QMS_init,QMS_reset, 
  1328.        QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
  1329.        QMS_linetype,QMS_put_text, null_text_angle, 
  1330.        null_justify_text, line_and_point, do_arrow}
  1331. #endif
  1332.  
  1333. #ifdef REGIS
  1334.     ,{"regis", "REGIS graphics language",
  1335.        REGISXMAX, REGISYMAX, REGISVCHAR, REGISHCHAR, 
  1336.        REGISVTIC, REGISHTIC, REGISoptions, REGISinit, REGISreset, 
  1337.        REGIStext, null_scale, REGISgraphics, REGISmove, REGISvector,
  1338.        REGISlinetype, REGISput_text, REGIStext_angle, 
  1339.        null_justify_text, line_and_point, do_arrow}
  1340. #endif
  1341.  
  1342. #ifdef RGIP
  1343.     ,{"rgip", "RGIP metafile (Uniplex). Option: fontsize (1-8)",
  1344.        RGIP_XMAX, RGIP_YMAX, RGIP_VCHAR, RGIP_HCHAR,
  1345.        RGIP_VTIC, RGIP_HTIC, RGIP_options, RGIP_init, RGIP_reset,
  1346.        RGIP_text, null_scale, RGIP_graphics, RGIP_move,
  1347.        RGIP_vector, RGIP_linetype, RGIP_put_text, RGIP_text_angle,
  1348.        RGIP_justify_text, RGIP_do_point, do_arrow}
  1349.     ,{"uniplex", "RGIP metafile (Uniplex). Option: fontsize (1-8)",
  1350.        RGIP_XMAX, RGIP_YMAX, RGIP_VCHAR, RGIP_HCHAR,
  1351.        RGIP_VTIC, RGIP_HTIC, RGIP_options, RGIP_init, RGIP_reset,
  1352.        RGIP_text, null_scale, RGIP_graphics, RGIP_move,
  1353.        RGIP_vector, RGIP_linetype, RGIP_put_text, RGIP_text_angle,
  1354.        RGIP_justify_text, RGIP_do_point, do_arrow}
  1355. #endif
  1356.  
  1357. #ifdef SELANAR
  1358.     ,{"selanar", "Selanar",
  1359.        TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1360.        TEK40VTIC, TEK40HTIC, options_null, SEL_init, SEL_reset, 
  1361.        SEL_text, null_scale, SEL_graphics, TEK40move, TEK40vector, 
  1362.        TEK40linetype, TEK40put_text, null_text_angle, 
  1363.        null_justify_text, line_and_point, do_arrow}
  1364. #endif
  1365.  
  1366. #ifdef STARC
  1367.     ,{"starc", "Star Color Printer",
  1368.        STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR, 
  1369.        STARCVTIC, STARCHTIC, options_null, STARCinit, STARCreset, 
  1370.        STARCtext, null_scale, STARCgraphics, STARCmove, STARCvector, 
  1371.        STARClinetype, STARCput_text, STARC_text_angle, 
  1372.        null_justify_text, line_and_point, do_arrow}
  1373. #endif
  1374.  
  1375. #ifdef SUN
  1376.     ,{"sun", "SunView window system",
  1377.        SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR, 
  1378.        SUN_VTIC, SUN_HTIC, options_null, SUN_init, SUN_reset, 
  1379.        SUN_text, null_scale, SUN_graphics, SUN_move, SUN_vector,
  1380.        SUN_linetype, SUN_put_text, null_text_angle, 
  1381.        SUN_justify_text, line_and_point, do_arrow}
  1382. #endif
  1383.  
  1384. #ifdef VWS
  1385.     ,{"VWS", "VAX Windowing System (UIS)",
  1386.            VWS_XMAX, VWS_YMAX, VWS_VCHAR, VWS_HCHAR,
  1387.            VWS_VTIC, VWS_HTIC, options_null, VWS_init, VWS_reset,
  1388.            VWS_text, null_scale, VWS_graphics, VWS_move, VWS_vector,
  1389.            VWS_linetype, VWS_put_text, VWS_text_angle,
  1390.            VWS_justify_text, do_point, do_arrow}
  1391. #endif
  1392.  
  1393. #ifdef TANDY60
  1394.     ,{"tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
  1395.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1396.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1397.        TANDY60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1398.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1399.        null_justify_text, do_point, do_arrow}
  1400. #endif
  1401.  
  1402. #ifdef T410X
  1403.     ,{"tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
  1404.        T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR, 
  1405.        T410XVTIC, T410XHTIC, options_null, T410X_init, T410X_reset, 
  1406.        T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector, 
  1407.        T410X_linetype, T410X_put_text, T410X_text_angle, 
  1408.        null_justify_text, T410X_point, do_arrow}
  1409. #endif
  1410.  
  1411. #ifdef TEK
  1412.     ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
  1413.        TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1414.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, TEK40reset, 
  1415.        TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector, 
  1416.        TEK40linetype, TEK40put_text, null_text_angle, 
  1417.        null_justify_text, line_and_point, do_arrow}
  1418. #endif
  1419.  
  1420. #ifdef TEXDRAW
  1421.     ,{"texdraw", "LaTeX texdraw environment",
  1422.        TEXDRAW_XMAX, TEXDRAW_YMAX, TEXDRAW_VCHAR, TEXDRAW_HCHAR,
  1423.     TEXDRAW_VTIC, TEXDRAW_HTIC, options_null, TEXDRAW_init, TEXDRAW_reset,
  1424.     TEXDRAW_text, TEXDRAW_scale, TEXDRAW_graphics, TEXDRAW_move, TEXDRAW_vector,
  1425.     TEXDRAW_linetype, TEXDRAW_put_text, TEXDRAW_text_angle,
  1426.     TEXDRAW_justify_text, TEXDRAW_point, TEXDRAW_arrow}
  1427. #endif
  1428.   
  1429. #ifdef TGIF
  1430.     ,{"tgif", "TGIF X-Window draw tool (file version 10)",
  1431.        TGIF_XMAX, TGIF_YMAX, TGIF_VCHAR1, TGIF_HCHAR1, 
  1432.        TGIF_VTIC, TGIF_HTIC, options_null, TGIF_init, TGIF_reset, 
  1433.        TGIF_text, null_scale, TGIF_graphics, TGIF_move, TGIF_vector, 
  1434.        TGIF_linetype, TGIF_put_text, TGIF_text_angle, 
  1435.        TGIF_justify_text, line_and_point, TGIF_arrow}
  1436. #endif
  1437.  
  1438. #ifdef TPIC
  1439.     ,{"tpic", "TPIC -- LaTeX picture environment with tpic \\specials",
  1440.        TPIC_XMAX, TPIC_YMAX, TPIC_VCHAR, TPIC_HCHAR, 
  1441.        TPIC_VTIC, TPIC_HTIC, TPIC_options, TPIC_init, TPIC_reset, 
  1442.        TPIC_text, TPIC_scale, TPIC_graphics, TPIC_move, TPIC_vector, 
  1443.        TPIC_linetype, TPIC_put_text, TPIC_text_angle, 
  1444.        TPIC_justify_text, TPIC_point, TPIC_arrow}
  1445. #endif
  1446.  
  1447. #ifdef UNIXPLOT
  1448. #ifdef GNUGRAPH
  1449.     ,{"unixplot", "GNU plot(1) format [\042fontname\042 font_size]",
  1450.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR,
  1451.        UP_VTIC, UP_HTIC, UP_options, UP_init, UP_reset,
  1452.        UP_text, null_scale, UP_graphics, UP_move, UP_vector,
  1453.        UP_linetype, UP_put_text, UP_text_angle,
  1454.        UP_justify_text, line_and_point, do_arrow}
  1455. #else
  1456.     ,{"unixplot", "Unix plotting standard (see plot(1))",
  1457.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR, 
  1458.        UP_VTIC, UP_HTIC, options_null, UP_init, UP_reset, 
  1459.        UP_text, null_scale, UP_graphics, UP_move, UP_vector, 
  1460.        UP_linetype, UP_put_text, null_text_angle, 
  1461.        null_justify_text, line_and_point, do_arrow}
  1462. #endif /* GNUGRAPH */
  1463. #endif
  1464.     
  1465. #ifdef UNIXPC
  1466.     ,{"unixpc", "AT&T 3b1 or AT&T 7300 Unix PC",
  1467.        uPC_XMAX, uPC_YMAX, uPC_VCHAR, uPC_HCHAR, 
  1468.        uPC_VTIC, uPC_HTIC, options_null, uPC_init, uPC_reset, 
  1469.        uPC_text, null_scale, uPC_graphics, uPC_move, uPC_vector,
  1470.        uPC_linetype, uPC_put_text, uPC_text_angle, 
  1471.        null_justify_text, line_and_point, do_arrow}
  1472. #endif
  1473.  
  1474. #ifdef EMXVGA
  1475. #ifdef EMXVESA
  1476.     ,{"vesa", "IBM PC/Clone with VESA SVGA graphics board [vesa mode]",
  1477.        EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
  1478.        EMXVGA_VTIC, EMXVGA_HTIC, EMXVESA_options, EMXVESA_init, EMXVESA_reset,
  1479.        EMXVESA_text, null_scale, EMXVESA_graphics, EMXVGA_move, EMXVGA_vector,
  1480.        EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle, 
  1481.        null_justify_text, do_point, do_arrow}
  1482. #endif
  1483.     ,{"vgal", "IBM PC/Clone with VGA graphics board",
  1484.        EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
  1485.        EMXVGA_VTIC, EMXVGA_HTIC, options_null, EMXVGA_init, EMXVGA_reset,
  1486.        EMXVGA_text, null_scale, EMXVGA_graphics, EMXVGA_move, EMXVGA_vector,
  1487.        EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle, 
  1488.        null_justify_text, do_point, do_arrow}
  1489. #endif
  1490.  
  1491. #ifdef V384
  1492.     ,{"vx384", "Vectrix 384 and Tandy color printer",
  1493.        V384_XMAX, V384_YMAX, V384_VCHAR, V384_HCHAR, 
  1494.        V384_VTIC, V384_HTIC, options_null, V384_init, V384_reset, 
  1495.        V384_text, null_scale, V384_graphics, V384_move, V384_vector, 
  1496.        V384_linetype, V384_put_text, null_text_angle, 
  1497.        null_justify_text, do_point, do_arrow}
  1498. #endif
  1499.  
  1500. #ifdef VTTEK
  1501.     ,{"vttek", "VT-like tek40xx terminal emulator",
  1502.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, TEK40HCHAR,
  1503.        TEK40VTIC, TEK40HTIC, options_null, VTTEK40init, VTTEK40reset,
  1504.        TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
  1505.        VTTEK40linetype, VTTEK40put_text, null_text_angle,
  1506.        null_justify_text, line_and_point, do_arrow}
  1507. #endif
  1508.  
  1509. #ifdef _Windows
  1510.     ,{"windows", "Microsoft Windows",
  1511.        WIN_XMAX, WIN_YMAX, WIN_VCHAR, WIN_HCHAR, 
  1512.        WIN_VTIC, WIN_HTIC, WIN_options, WIN_init, WIN_reset, 
  1513.        WIN_text, WIN_scale, WIN_graphics, WIN_move, WIN_vector,
  1514.        WIN_linetype, WIN_put_text, WIN_text_angle, 
  1515.        WIN_justify_text, WIN_point, do_arrow}
  1516. #endif
  1517.  
  1518. #ifdef X11
  1519.     ,{"x11", "X11 Window System",
  1520.        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1521.        X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1522.        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1523.        X11_linetype, X11_put_text, null_text_angle, 
  1524.        X11_justify_text, X11_point, do_arrow}
  1525.     ,{"X11", "X11 Window System (identical to x11)",
  1526.        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1527.        X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1528.        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1529.        X11_linetype, X11_put_text, null_text_angle, 
  1530.        X11_justify_text, X11_point, do_arrow}
  1531.    ,{"xlib", "X11 Window System (gnulib_x11 dump)",
  1532.        Xlib_XMAX, Xlib_YMAX, Xlib_VCHAR, Xlib_HCHAR, 
  1533.        Xlib_VTIC, Xlib_HTIC, options_null, Xlib_init, Xlib_reset, 
  1534.        Xlib_text, null_scale, Xlib_graphics, Xlib_move, Xlib_vector, 
  1535.        Xlib_linetype, Xlib_put_text, null_text_angle, 
  1536.        Xlib_justify_text, line_and_point, do_arrow}
  1537. #endif
  1538.  
  1539. #ifdef LINUX
  1540.     ,{"linux", "PC with VGA adaptor running Linux",
  1541.        LINUX_XMAX, LINUX_YMAX, LINUX_VCHAR, LINUX_HCHAR,
  1542.        LINUX_VTIC, LINUX_HTIC, options_null, LINUX_init, LINUX_reset,
  1543.        LINUX_text, null_scale, LINUX_graphics, LINUX_move, LINUX_vector,
  1544.        LINUX_linetype, LINUX_put_text, LINUX_text_angle,
  1545.        null_justify_text, do_point, do_arrow}
  1546. #endif
  1547. };
  1548.  
  1549. #define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
  1550.  
  1551.  
  1552. list_terms()
  1553. {
  1554. register int i;
  1555.  
  1556.     fprintf(stderr,"\nAvailable terminal types:\n");
  1557.     for (i = 0; i < TERMCOUNT; i++)
  1558.         fprintf(stderr,"  %15s  %s\n",
  1559.                term_tbl[i].name, term_tbl[i].description);
  1560.     (void) putc('\n',stderr);
  1561. }
  1562.  
  1563.  
  1564. /* set_term: get terminal number from name on command line */
  1565. /* will change 'term' variable if successful */
  1566. int                        /* term number */
  1567. set_term(c_token)
  1568. int c_token;
  1569. {
  1570.     register int t;
  1571.     char *input_name;
  1572.  
  1573.     if (!token[c_token].is_token)
  1574.      int_error("terminal name expected",c_token);
  1575.     t = -1;
  1576.     input_name = input_line + token[c_token].start_index;
  1577.     t = change_term(input_name, token[c_token].length);
  1578.     if (t == -1)
  1579.      int_error("unknown terminal type; type just 'set terminal' for a list",
  1580.              c_token);
  1581.     if (t == -2)
  1582.      int_error("ambiguous terminal name; type just 'set terminal' for a list",
  1583.              c_token);
  1584.  
  1585.     /* otherwise the type was changed */
  1586.  
  1587.     return(t);
  1588. }
  1589.  
  1590. /* change_term: get terminal number from name and set terminal type */
  1591. /* returns -1 if unknown, -2 if ambiguous, >=0 is terminal number */
  1592. int
  1593. change_term(name, length)
  1594.     char *name;
  1595.     int length;
  1596. {
  1597.     int i, t = -1;
  1598.  
  1599.     for (i = 0; i < TERMCOUNT; i++) {
  1600.        if (!strncmp(name,term_tbl[i].name,length)) {
  1601.           if (t != -1)
  1602.             return(-2);    /* ambiguous */
  1603.           t = i;
  1604.        }
  1605.     }
  1606.  
  1607.     if (t == -1)            /* unknown */
  1608.      return(t);
  1609.  
  1610.     /* Success: set terminal type now */
  1611.  
  1612.     term = t;
  1613.     term_init = FALSE;
  1614.     name = term_tbl[term].name;
  1615.  
  1616.     /* Special handling for unixplot term type */
  1617.     if (!strncmp("unixplot",name,8)) {
  1618.        UP_redirect (2);  /* Redirect actual stdout for unixplots */
  1619.     } else if (unixplot) {
  1620.        UP_redirect (3);  /* Put stdout back together again. */
  1621.     }
  1622.  
  1623.     if (interactive)
  1624.      fprintf(stderr, "Terminal type set to '%s'\n", name);
  1625.  
  1626.     return(t);
  1627. }
  1628.  
  1629. /*
  1630.    Routine to detect what terminal is being used (or do anything else
  1631.    that would be nice).  One anticipated (or allowed for) side effect
  1632.    is that the global ``term'' may be set. 
  1633.    The environment variable GNUTERM is checked first; if that does
  1634.    not exist, then the terminal hardware is checked, if possible, 
  1635.    and finally, we can check $TERM for some kinds of terminals.
  1636.    A default can be set with -DDEFAULTTERM=myterm in the Makefile
  1637.    or #define DEFAULTTERM myterm in term.h
  1638. */
  1639. /* thanks to osupyr!alden (Dave Alden) for the original GNUTERM code */
  1640. init_terminal()
  1641. {
  1642.     int t;
  1643. #ifdef DEFAULTTERM
  1644.     char *term_name = DEFAULTTERM;
  1645. #else
  1646.     char *term_name = NULL;
  1647. #endif /* DEFAULTTERM */
  1648. #if (defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)) || defined(NEXT) || defined(SUN) || defined(X11)
  1649.     char *term = NULL;        /* from TERM environment var */
  1650. #endif
  1651. #ifdef X11
  1652.     char *display = NULL;
  1653. #endif
  1654.     char *gnuterm = NULL;
  1655.  
  1656.     /* GNUTERM environment variable is primary */
  1657.     gnuterm = getenv("GNUTERM");
  1658.     if (gnuterm != (char *)NULL) {
  1659.      term_name = gnuterm;
  1660. #ifndef _Windows
  1661. #if defined(__TURBOC__) && defined(MSDOS)
  1662.          get_path();   /* So *_init() can find the BGI driver */
  1663. # endif
  1664. #endif
  1665.     }
  1666.     else {
  1667. #if defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)
  1668.        term_name = turboc_init();
  1669.        term = (char *)NULL; /* shut up turbo C */
  1670. #endif
  1671.        
  1672. #ifdef __ZTC__
  1673.       term_name = ztc_init();
  1674. #endif
  1675.  
  1676. #ifdef vms
  1677.        term_name = vms_init();
  1678. #endif
  1679.  
  1680. #ifdef NEXT
  1681.     term = getenv("TERM");
  1682.     if (term_name == (char *)NULL
  1683.         && term != (char *)NULL && strcmp(term,"next") == 0)
  1684.           term_name = "next";
  1685. #endif /* NeXT */
  1686.        
  1687. #ifdef SUN
  1688.        term = getenv("TERM");    /* try $TERM */
  1689.        if (term_name == (char *)NULL
  1690.           && term != (char *)NULL && strcmp(term, "sun") == 0)
  1691.         term_name = "sun";
  1692. #endif /* sun */
  1693.  
  1694. #ifdef _Windows
  1695.         term_name = "win";
  1696. #endif /* _Windows */
  1697.  
  1698. #ifdef GPR
  1699.    if (gpr_isa_pad()) term_name = "gpr";       /* find out whether stdout is a DM pad. See term/gpr.trm */
  1700. #else
  1701. #ifdef APOLLO
  1702.    if (apollo_isa_pad()) term_name = "apollo"; /* find out whether stdout is a DM pad. See term/apollo.trm */
  1703. #endif /* APOLLO */
  1704. #endif /* GPR    */
  1705.  
  1706. #ifdef X11
  1707.        term = getenv("TERM");    /* try $TERM */
  1708.        if (term_name == (char *)NULL
  1709.           && term != (char *)NULL && strcmp(term, "xterm") == 0)
  1710.         term_name = "x11";
  1711.        display = getenv("DISPLAY");
  1712.        if (term_name == (char *)NULL && display != (char *)NULL)
  1713.         term_name = "x11";
  1714.        if (X11_Display)
  1715.         term_name = "x11";
  1716. #endif /* x11 */
  1717.  
  1718. #ifdef AMIGASCREEN
  1719.        term_name = "amiga";
  1720. #endif
  1721.  
  1722. #ifdef ATARI
  1723.        term_name = "atari";
  1724. #endif
  1725.  
  1726. #ifdef UNIXPC
  1727.            if (iswind() == 0) {
  1728.               term_name = "unixpc";
  1729.            }
  1730. #endif /* unixpc */
  1731.  
  1732. #ifdef CGI
  1733.        if (getenv("CGIDISP") || getenv("CGIPRNT"))
  1734.          term_name = "cgi";
  1735. #endif /*CGI */
  1736.  
  1737. #if defined(MSDOS) && defined(__EMX__)
  1738. #ifdef EMXVESA
  1739.        term_name = "vesa";
  1740. #else
  1741.        term_name = "vgal";
  1742. #endif
  1743. #endif
  1744.  
  1745. #ifdef DJGPP
  1746.         term_name = "svga";
  1747. #endif
  1748.  
  1749. #ifdef GRASS
  1750.         term_name = "grass";
  1751. #endif
  1752.  
  1753. #ifdef OS2
  1754.            term_name = "pm" ;
  1755.             /* EMX compiler has getcwd that can return drive */
  1756.            if( PM_path[0]=='\0' ) _getcwd2( PM_path, 256 ) ;
  1757. #endif /*OS2 */           
  1758.  
  1759. /* we prefer X11 as default compatible to gnuplot */
  1760. #if defined (LINUX)  &&  !defined (X11)
  1761.        term_name = "linux";
  1762. #endif /* LINUX */
  1763.     }
  1764.  
  1765.     /* We have a name, try to set term type */
  1766.     if (term_name != NULL && *term_name != '\0') {
  1767.        t = change_term(term_name, (int)strlen(term_name));
  1768.        if (t == -1)
  1769.         fprintf(stderr, "Unknown terminal name '%s'\n", term_name);
  1770.        else if (t == -2)
  1771.         fprintf(stderr, "Ambiguous terminal name '%s'\n", term_name);
  1772.        else                /* successful */
  1773.         ;
  1774.     }
  1775. }
  1776.  
  1777.  
  1778. #ifndef _Windows
  1779. #if defined (__TURBOC__) && defined (MSDOS)
  1780. char *
  1781. turboc_init()
  1782. {
  1783.   int g_driver,g_mode;
  1784.   char far *c1,*c2;
  1785.   char *term_name = NULL;
  1786.   struct text_info tinfo;       /* So we can restore starting text mode. */
  1787.  
  1788. /* Some of this code including BGI drivers is copyright Borland Intl. */
  1789.     g_driver=DETECT;
  1790.           get_path();
  1791.     gettextinfo(&tinfo);
  1792.         initgraph(&g_driver,&g_mode,path);
  1793.         c1=getdrivername();
  1794.         c2=getmodename(g_mode);
  1795.           switch (g_driver){
  1796.             case -2: fprintf(stderr,"Graphics card not detected.\n");
  1797.                      break;
  1798.             case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
  1799.                      break;
  1800.             case -4: fprintf(stderr,"Invalid BGI driver file.\n");
  1801.                      break;
  1802.             case -5: fprintf(stderr,"Insufficient memory to load ",
  1803.                              "graphics driver.");
  1804.                      break;
  1805.             case 1 : term_name = "cga";
  1806.                      break;
  1807.             case 2 : term_name = "mcga";
  1808.                      break;
  1809.             case 3 : 
  1810.             case 4 : term_name = "egalib";
  1811.                      break;
  1812.             case 7 : term_name = "hercules";
  1813.                      break;
  1814.             case 8 : term_name = "att";
  1815.                      break;
  1816.             case 9 : term_name = "vgalib";
  1817.                      break;
  1818.             }
  1819.         closegraph();
  1820.         textmode(tinfo.currmode);
  1821.     clrscr();
  1822.     fprintf(stderr,"\tTC Graphics, driver %s  mode %s\n",c1,c2);
  1823.   return(term_name);
  1824. }
  1825. # endif /* __TURBOC__ */
  1826. #endif
  1827.  
  1828. #if defined(__ZTC__)
  1829. char *
  1830. ztc_init()
  1831. {
  1832.   int g_mode;
  1833.   char *term_name = NULL;
  1834.  
  1835.     g_mode = fg_init();
  1836.  
  1837.           switch (g_mode){
  1838.             case FG_NULL      :  fprintf(stderr,"Graphics card not detected or not supported.\n");
  1839.                                  exit(1);
  1840.             case FG_HERCFULL  :  term_name = "hercules";
  1841.                                  break;
  1842.             case FG_EGAMONO   :  term_name = "egamono";
  1843.                                  break;
  1844.             case FG_EGAECD      :  term_name = "egalib";
  1845.                                  break;
  1846.             case FG_VGA11      :  term_name = "vgamono";
  1847.                                  break;
  1848.             case FG_VGA12      :  term_name = "vgalib";
  1849.                                  break;
  1850.             case FG_VESA6A      :  term_name = "svgalib";
  1851.                                  break;
  1852.             case FG_VESA5      :  term_name = "ssvgalib";
  1853.                                  break;
  1854.             }
  1855.         fg_term();
  1856.   return(term_name);
  1857. }
  1858. #endif /* __ZTC__ */
  1859.  
  1860.  
  1861. /*
  1862.     This is always defined so we don't have to have command.c know if it
  1863.     is there or not.
  1864. */
  1865. #ifndef UNIXPLOT
  1866. UP_redirect(caller) int caller; 
  1867. {
  1868.     caller = caller;    /* to stop Turbo C complaining 
  1869.                          * about caller not being used */
  1870. }
  1871. #else
  1872. UP_redirect (caller)
  1873. int caller;
  1874. /*
  1875.     Unixplot can't really write to outfile--it wants to write to stdout.
  1876.     This is normally ok, but the original design of gnuplot gives us
  1877.     little choice.  Originally users of unixplot had to anticipate
  1878.     their needs and redirect all I/O to a file...  Not very gnuplot-like.
  1879.  
  1880.     caller:  1 - called from SET OUTPUT "FOO.OUT"
  1881.              2 - called from SET TERM UNIXPLOT
  1882.              3 - called from SET TERM other
  1883.              4 - called from SET OUTPUT
  1884. */
  1885. {
  1886.     switch (caller) {
  1887.     case 1:
  1888.     /* Don't save, just replace stdout w/outfile (save was already done). */
  1889.         if (unixplot)
  1890.             *(stdout) = *(outfile);  /* Copy FILE structure */
  1891.     break;
  1892.     case 2:
  1893.         if (!unixplot) {
  1894.             fflush(stdout);
  1895.             save_stdout = *(stdout);
  1896.             *(stdout) = *(outfile);  /* Copy FILE structure */
  1897.             unixplot = 1;
  1898.         }
  1899.     break;
  1900.     case 3:
  1901.     /* New terminal in use--put stdout back to original. */
  1902.         /* closepl(); */  /* This is called by the term. */
  1903.         fflush(stdout);
  1904.         *(stdout) = save_stdout;  /* Copy FILE structure */
  1905.         unixplot = 0;
  1906.     break;
  1907.     case 4:
  1908.     /*  User really wants to go to normal output... */
  1909.         if (unixplot) {
  1910.             fflush(stdout);
  1911.             *(stdout) = save_stdout;  /* Copy FILE structure */
  1912.         }
  1913.     break;
  1914.     }
  1915. }
  1916. #endif
  1917.  
  1918.  
  1919. /* test terminal by drawing border and text */
  1920. /* called from command test */
  1921. test_term()
  1922. {
  1923.     register struct termentry *t = &term_tbl[term];
  1924.     char *str;
  1925.     int x,y, xl,yl, i;
  1926.     unsigned int xmax, ymax;
  1927.     char label[MAX_ID_LEN];
  1928.     int scaling;
  1929.  
  1930.     if (!term_init) {
  1931.        (*t->init)();
  1932.        term_init = TRUE;
  1933.     }
  1934.     screen_ok = FALSE;
  1935.     scaling = (*t->scale)(xsize, ysize);
  1936.     xmax = (unsigned int)(t->xmax * (scaling ? 1 : xsize));
  1937.     ymax = (unsigned int)(t->ymax * (scaling ? 1 : ysize));
  1938.     (*t->graphics)();
  1939.     /* border linetype */
  1940.     (*t->linetype)(-2);
  1941.     (*t->move)(0,0);
  1942.     (*t->vector)(xmax-1,0);
  1943.     (*t->vector)(xmax-1,ymax-1);
  1944.     (*t->vector)(0,ymax-1);
  1945.     (*t->vector)(0,0);
  1946.     (void) (*t->justify_text)(LEFT);
  1947.     (*t->put_text)(t->h_char*5,ymax-t->v_char*3,"Terminal Test");
  1948.     /* axis linetype */
  1949.     (*t->linetype)(-1);
  1950.     (*t->move)(xmax/2,0);
  1951.     (*t->vector)(xmax/2,ymax-1);
  1952.     (*t->move)(0,ymax/2);
  1953.     (*t->vector)(xmax-1,ymax/2);
  1954.     /* test width and height of characters */
  1955.     (*t->linetype)(-2);
  1956.     (*t->move)(  xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1957.     (*t->vector)(xmax/2+t->h_char*10,ymax/2+t->v_char/2);
  1958.     (*t->vector)(xmax/2+t->h_char*10,ymax/2-t->v_char/2);
  1959.     (*t->vector)(xmax/2-t->h_char*10,ymax/2-t->v_char/2);
  1960.     (*t->vector)(xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1961.     (*t->put_text)(xmax/2-t->h_char*10,ymax/2,
  1962.         "12345678901234567890");
  1963.     /* test justification */
  1964.     (void) (*t->justify_text)(LEFT);
  1965.     (*t->put_text)(xmax/2,ymax/2+t->v_char*6,"left justified");
  1966.     str = "centre+d text";
  1967.     if ((*t->justify_text)(CENTRE))
  1968.         (*t->put_text)(xmax/2,
  1969.                 ymax/2+t->v_char*5,str);
  1970.     else
  1971.         (*t->put_text)(xmax/2-strlen(str)*t->h_char/2,
  1972.                 ymax/2+t->v_char*5,str);
  1973.     str = "right justified";
  1974.     if ((*t->justify_text)(RIGHT))
  1975.         (*t->put_text)(xmax/2,
  1976.                 ymax/2+t->v_char*4,str);
  1977.     else
  1978.         (*t->put_text)(xmax/2-strlen(str)*t->h_char,
  1979.                 ymax/2+t->v_char*4,str);
  1980.     /* test text angle */
  1981.     str = "rotated ce+ntred text";
  1982.     if ((*t->text_angle)(1)) {
  1983.         if ((*t->justify_text)(CENTRE))
  1984.             (*t->put_text)(t->v_char,
  1985.                 ymax/2,str);
  1986.         else
  1987.             (*t->put_text)(t->v_char,
  1988.                 ymax/2-strlen(str)*t->h_char/2,str);
  1989.     }
  1990.     else {
  1991.         (void) (*t->justify_text)(LEFT);
  1992.         (*t->put_text)(t->h_char*2,ymax/2-t->v_char*2,"Can't rotate text");
  1993.     }
  1994.     (void) (*t->justify_text)(LEFT);
  1995.     (void) (*t->text_angle)(0);
  1996.     /* test tic size */
  1997.     (*t->move)(xmax/2+t->h_tic*2,0);
  1998.     (*t->vector)(xmax/2+t->h_tic*2,t->v_tic);
  1999.     (*t->move)(xmax/2,t->v_tic*2);
  2000.     (*t->vector)(xmax/2+t->h_tic,t->v_tic*2);
  2001.     (*t->put_text)(xmax/2+t->h_tic*2,t->v_tic*2+t->v_char/2,"test tics");
  2002.     /* test line and point types */
  2003.     x = xmax - t->h_char*4 - t->h_tic*4;
  2004.     y = ymax - t->v_char;
  2005.     for ( i = -2; y > t->v_char; i++ ) {
  2006.         (*t->linetype)(i);
  2007.         /*    (void) sprintf(label,"%d",i);  Jorgen Lippert
  2008.         lippert@risoe.dk */
  2009.         (void) sprintf(label,"%d",i+1);
  2010.         if ((*t->justify_text)(RIGHT))
  2011.             (*t->put_text)(x,y,label);
  2012.         else
  2013.             (*t->put_text)(x-strlen(label)*t->h_char,y,label);
  2014.         (*t->move)(x+t->h_char,y);
  2015.         (*t->vector)(x+t->h_char*4,y);
  2016.         if ( i >= -1 )
  2017.             (*t->point)(x+t->h_char*4+t->h_tic*2,y,i);
  2018.         y -= t->v_char;
  2019.     }
  2020.     /* test some arrows */
  2021.     (*t->linetype)(0);
  2022.     x = xmax/4;
  2023.     y = ymax/4;
  2024.     xl = t->h_tic*5;
  2025.     yl = t->v_tic*5;
  2026.     (*t->arrow)(x,y,x+xl,y,TRUE);
  2027.     (*t->arrow)(x,y,x+xl/2,y+yl,TRUE);
  2028.     (*t->arrow)(x,y,x,y+yl,TRUE);
  2029.     (*t->arrow)(x,y,x-xl/2,y+yl,FALSE);
  2030.     (*t->arrow)(x,y,x-xl,y,TRUE);
  2031.     (*t->arrow)(x,y,x-xl,y-yl,TRUE);
  2032.     (*t->arrow)(x,y,x,y-yl,TRUE);
  2033.     (*t->arrow)(x,y,x+xl,y-yl,TRUE);
  2034.     /* and back into text mode */
  2035.     (*t->text)();
  2036. }
  2037.  
  2038.  
  2039. #if defined(MSDOS)||defined(ATARI)||defined(OS2)||defined(_Windows)||defined(DOS386)
  2040. /* output for some terminal types must be binary to stop non Unix computers
  2041.    changing \n to \r\n. 
  2042.    If the output is not STDOUT, the following code reopens outfile 
  2043.    with binary mode. */
  2044. void
  2045. reopen_binary()
  2046. {
  2047. char filename[MAX_ID_LEN+1];
  2048.  
  2049.     if (outfile!=stdout) {
  2050.         (void) fclose(outfile);
  2051.         (void) strcpy(filename,outstr+1);    /* remove quotes */
  2052.         filename[strlen(filename)-1] = '\0';
  2053. #ifdef _Windows
  2054.         if ( !stricmp(outstr,"'PRN'") )
  2055.             (void) strcpy(filename,win_prntmp);    /* use temp file for windows */
  2056. #endif
  2057.         if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
  2058.             if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  2059.                 os_error("cannot reopen file with binary type; output unknown",
  2060.                     NO_CARET);
  2061.             } 
  2062.             else {
  2063.     os_error("cannot reopen file with binary type; output reset to ascii", 
  2064.                     NO_CARET);
  2065.             }
  2066.         }
  2067. #if defined(__TURBOC__) && defined(MSDOS)
  2068. #ifndef _Windows
  2069.         if ( !stricmp(outstr,"'PRN'") )
  2070.         {
  2071.         /* Put the printer into binary mode. */
  2072.         union REGS regs;
  2073.             regs.h.ah = 0x44;    /* ioctl */
  2074.             regs.h.al = 0;        /* get device info */
  2075.             regs.x.bx = fileno(outfile);
  2076.             intdos(®s, ®s);
  2077.             regs.h.dl |= 0x20;    /* binary (no ^Z intervention) */
  2078.             regs.h.dh = 0;
  2079.             regs.h.ah = 0x44;    /* ioctl */
  2080.             regs.h.al = 1;        /* set device info */
  2081.             intdos(®s, ®s);
  2082.         }
  2083. #endif
  2084. #endif
  2085.     }
  2086. }
  2087. #endif
  2088.  
  2089. #ifdef vms
  2090. /* these are needed to modify terminal characteristics */
  2091. #include <descrip.h>
  2092. #include <iodef.h>
  2093. #include <ttdef.h>
  2094. #include <tt2def.h>
  2095. #include <dcdef.h>
  2096. #include <ssdef.h>
  2097. #include <stat.h>
  2098. #include <fab.h>
  2099. static unsigned short   chan;
  2100. static int  old_char_buf[3], cur_char_buf[3];
  2101. $DESCRIPTOR(sysoutput_desc,"SYS$OUTPUT");
  2102.  
  2103. char *vms_init()
  2104. /*
  2105.  * Determine if we have a regis terminal
  2106.  * and save terminal characteristics
  2107. */
  2108. {
  2109.    /* Save terminal characteristics in old_char_buf and
  2110.    initialise cur_char_buf to current settings. */
  2111.    int i;
  2112.    sys$assign(&sysoutput_desc,&chan,0,0);
  2113.    sys$qiow(0,chan,IO$_SENSEMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2114.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2115.    sys$dassgn(chan);
  2116.  
  2117.    /* Test if terminal is regis */
  2118.    if ((cur_char_buf[2] & TT2$M_REGIS) == TT2$M_REGIS) return("regis");
  2119.    return(NULL);
  2120. }
  2121.  
  2122. void
  2123. vms_reset()
  2124. /* set terminal to original state */
  2125. {
  2126.    int i;
  2127.    sys$assign(&sysoutput_desc,&chan,0,0);
  2128.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2129.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2130.    sys$dassgn(chan);
  2131. }
  2132.  
  2133. void
  2134. term_mode_tek()
  2135. /* set terminal mode to tektronix */
  2136. {
  2137.    long status;
  2138.    if (outfile != stdout) return; /* don't modify if not stdout */
  2139.    sys$assign(&sysoutput_desc,&chan,0,0);
  2140.    cur_char_buf[0] = 0x004A0000 | DC$_TERM | (TT$_TEK401X<<8);
  2141.    cur_char_buf[1] = (cur_char_buf[1] & 0x00FFFFFF) | 0x18000000;
  2142.  
  2143.    cur_char_buf[1] &= ~TT$M_CRFILL;
  2144.    cur_char_buf[1] &= ~TT$M_ESCAPE;
  2145.    cur_char_buf[1] &= ~TT$M_HALFDUP;
  2146.    cur_char_buf[1] &= ~TT$M_LFFILL;
  2147.    cur_char_buf[1] &= ~TT$M_MECHFORM;
  2148.    cur_char_buf[1] &= ~TT$M_NOBRDCST;
  2149.    cur_char_buf[1] &= ~TT$M_NOECHO;
  2150.    cur_char_buf[1] &= ~TT$M_READSYNC;
  2151.    cur_char_buf[1] &= ~TT$M_REMOTE;
  2152.    cur_char_buf[1] |= TT$M_LOWER;
  2153.    cur_char_buf[1] |= TT$M_TTSYNC;
  2154.    cur_char_buf[1] |= TT$M_WRAP;
  2155.    cur_char_buf[1] &= ~TT$M_EIGHTBIT;
  2156.    cur_char_buf[1] &= ~TT$M_MECHTAB;
  2157.    cur_char_buf[1] &= ~TT$M_SCOPE;
  2158.    cur_char_buf[1] |= TT$M_HOSTSYNC;
  2159.  
  2160.    cur_char_buf[2] &= ~TT2$M_APP_KEYPAD;
  2161.    cur_char_buf[2] &= ~TT2$M_BLOCK;
  2162.    cur_char_buf[2] &= ~TT2$M_DECCRT3;
  2163.    cur_char_buf[2] &= ~TT2$M_LOCALECHO;
  2164.    cur_char_buf[2] &= ~TT2$M_PASTHRU;
  2165.    cur_char_buf[2] &= ~TT2$M_REGIS;
  2166.    cur_char_buf[2] &= ~TT2$M_SIXEL;
  2167.    cur_char_buf[2] |= TT2$M_BRDCSTMBX;
  2168.    cur_char_buf[2] |= TT2$M_EDITING;
  2169.    cur_char_buf[2] |= TT2$M_INSERT;
  2170.    cur_char_buf[2] |= TT2$M_PRINTER;
  2171.    cur_char_buf[2] &= ~TT2$M_ANSICRT;
  2172.    cur_char_buf[2] &= ~TT2$M_AVO;
  2173.    cur_char_buf[2] &= ~TT2$M_DECCRT;
  2174.    cur_char_buf[2] &= ~TT2$M_DECCRT2;
  2175.    cur_char_buf[2] &= ~TT2$M_DRCS;
  2176.    cur_char_buf[2] &= ~TT2$M_EDIT;
  2177.    cur_char_buf[2] |= TT2$M_FALLBACK;
  2178.  
  2179.    status = sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2180.    if (status == SS$_BADPARAM) {
  2181.       /* terminal fallback utility not installed on system */
  2182.       cur_char_buf[2] &= ~TT2$M_FALLBACK;
  2183.       sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2184.    }
  2185.    else {
  2186.       if (status != SS$_NORMAL)
  2187.          lib$signal(status,0,0);
  2188.    }
  2189.    sys$dassgn(chan);
  2190. }
  2191.  
  2192. void
  2193. term_mode_native()
  2194. /* set terminal mode back to native */
  2195. {
  2196.    int i;
  2197.    if (outfile != stdout) return; /* don't modify if not stdout */
  2198.    sys$assign(&sysoutput_desc,&chan,0,0);
  2199.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2200.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2201.    sys$dassgn(chan);
  2202. }
  2203.  
  2204. void
  2205. term_pasthru()
  2206. /* set terminal mode pasthru */
  2207. {
  2208.    if (outfile != stdout) return; /* don't modify if not stdout */
  2209.    sys$assign(&sysoutput_desc,&chan,0,0);
  2210.    cur_char_buf[2] |= TT2$M_PASTHRU;
  2211.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2212.    sys$dassgn(chan);
  2213. }
  2214.  
  2215. void
  2216. term_nopasthru()
  2217. /* set terminal mode nopasthru */
  2218. {
  2219.    if (outfile != stdout) return; /* don't modify if not stdout */
  2220.    sys$assign(&sysoutput_desc,&chan,0,0);
  2221.    cur_char_buf[2] &= ~TT2$M_PASTHRU;
  2222.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2223.    sys$dassgn(chan);
  2224. }
  2225.  
  2226. void
  2227. reopen_binary()
  2228. /* close the file outfile outfile and reopen it with binary type
  2229.    if not already done or outfile == stdout */
  2230. {
  2231.    stat_t stat_buf;
  2232.    char filename[MAX_ID_LEN+1];
  2233.    if (outfile != stdout) { /* don't modify if not stdout */
  2234.       if (!fstat(fileno(outfile),&stat_buf)) {
  2235.          if (stat_buf.st_fab_rfm != FAB$C_FIX) {
  2236.             /* modify only if not already done */
  2237.             (void) fclose(outfile);
  2238.             (void) strcpy(filename,outstr+1);   /* remove quotes */
  2239.             filename[strlen(filename)-1] = '\0';
  2240.             (void) delete(filename);
  2241.             if ((outfile = fopen(filename,"wb","rfm=fix","bls=512","mrs=512"))
  2242.                 == (FILE *)NULL ) {
  2243.                if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  2244.                  os_error("cannot reopen file with binary type; output unknown",
  2245.                            NO_CARET);
  2246.                }
  2247.                else {
  2248.           os_error("cannot reopen file with binary type; output reset to ascii",
  2249.                            NO_CARET);
  2250.                }
  2251.             }
  2252.          }
  2253.       }
  2254.       else{
  2255.          os_error("cannot reopen file with binary type; output remains ascii",
  2256.                   NO_CARET);
  2257.       }
  2258.    }
  2259. }
  2260.  
  2261. void
  2262. fflush_binary()
  2263. {
  2264.    typedef short int INT16;     /* signed 16-bit integers */
  2265.    register INT16 k;            /* loop index */
  2266.    if (outfile != stdout) {
  2267.        /* Stupid VMS fflush() raises error and loses last data block
  2268.           unless it is full for a fixed-length record binary file.
  2269.           Pad it here with NULL characters. */
  2270.        for (k = (INT16)((*outfile)->_cnt); k > 0; --k)
  2271.           putc('\0',outfile);
  2272.        fflush(outfile);
  2273.    }
  2274. }
  2275. #endif
  2276.